@todoist/mcp 21.0.0 → 21.0.1
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 +20 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/main-http.js +2 -2
- package/dist/main.js +1 -1
- package/dist/{mcp-server-gTECUZ_6.js → mcp-server-CSzZga3y.js} +795 -796
- package/dist/{require-valid-todoist-token-CND9-m2b.js → require-valid-todoist-token-DJ9E5D9Y.js} +1 -1
- package/dist/tool-registry.d.ts +20 -7
- package/dist/tool-registry.d.ts.map +1 -1
- package/dist/tools/manage-assignments.d.ts +20 -7
- package/dist/tools/manage-assignments.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -351,7 +351,7 @@ function ft(e) {
|
|
|
351
351
|
}
|
|
352
352
|
var pt = {
|
|
353
353
|
name: "@todoist/mcp",
|
|
354
|
-
version: "21.0.
|
|
354
|
+
version: "21.0.1",
|
|
355
355
|
type: "module",
|
|
356
356
|
main: "./dist/index.js",
|
|
357
357
|
types: "./dist/index.d.ts",
|
|
@@ -1353,7 +1353,7 @@ var Tr = /* @__PURE__ */ new WeakMap(), H = new class {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
async fetchProjectCollaborators(e, t, n) {
|
|
1355
1355
|
try {
|
|
1356
|
-
let r = (await
|
|
1356
|
+
let r = (await U({ apiMethod: (n) => e.getProjectCollaborators(t, n) })).filter((e) => e?.id && e.name && e.email);
|
|
1357
1357
|
return n && vr.set(n, r), r;
|
|
1358
1358
|
} catch {
|
|
1359
1359
|
return [];
|
|
@@ -1365,7 +1365,7 @@ var Tr = /* @__PURE__ */ new WeakMap(), H = new class {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
async fetchAllCollaborators(e, t, n) {
|
|
1367
1367
|
try {
|
|
1368
|
-
let r = (await
|
|
1368
|
+
let r = (await U({
|
|
1369
1369
|
apiMethod: e.getProjects.bind(e),
|
|
1370
1370
|
args: {}
|
|
1371
1371
|
})).filter((e) => e.isShared);
|
|
@@ -1461,17 +1461,17 @@ function Nr({ tasks: e, resolvedAssigneeId: t, currentUserId: n, responsibleUser
|
|
|
1461
1461
|
return t && !i ? e.filter((e) => e.responsibleUid === t) : i || r === "unassignedOrMe" ? e.filter((e) => !e.responsibleUid || e.responsibleUid === n) : r === "assigned" ? e.filter((e) => e.responsibleUid && e.responsibleUid !== n) : e;
|
|
1462
1462
|
}
|
|
1463
1463
|
// src/tool-helpers.ts
|
|
1464
|
-
function
|
|
1464
|
+
function Pr(e) {
|
|
1465
1465
|
return e?.toLowerCase() === "inbox";
|
|
1466
1466
|
}
|
|
1467
|
-
async function
|
|
1467
|
+
async function Fr(e) {
|
|
1468
1468
|
let { projectId: t, user: n, client: r } = e;
|
|
1469
|
-
if (!
|
|
1469
|
+
if (!Pr(t)) return t;
|
|
1470
1470
|
let i = n || (r ? await r.getUser() : null);
|
|
1471
1471
|
if (!i) throw Error("Either user or client must be provided when resolving inbox project ID");
|
|
1472
1472
|
return i.inboxProjectId;
|
|
1473
1473
|
}
|
|
1474
|
-
async function
|
|
1474
|
+
async function U(e) {
|
|
1475
1475
|
let { apiMethod: t, args: n, limit: r = 100 } = e, i = [], a = null;
|
|
1476
1476
|
do {
|
|
1477
1477
|
let e = await t({
|
|
@@ -1483,46 +1483,46 @@ async function W(e) {
|
|
|
1483
1483
|
} while (a !== null);
|
|
1484
1484
|
return i;
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1486
|
+
function Ir(e) {
|
|
1487
1487
|
return /(?<!\\)(?:\\\\)*\*/.test(e) ? e : `*${e.replaceAll(/\\(?!\*)/g, "\\\\")}*`;
|
|
1488
1488
|
}
|
|
1489
|
-
async function
|
|
1490
|
-
return
|
|
1489
|
+
async function Lr(e, t) {
|
|
1490
|
+
return U({
|
|
1491
1491
|
apiMethod: e.searchProjects.bind(e),
|
|
1492
|
-
args: { query:
|
|
1492
|
+
args: { query: Ir(t) },
|
|
1493
1493
|
limit: D.PROJECTS_MAX
|
|
1494
1494
|
});
|
|
1495
1495
|
}
|
|
1496
|
-
async function
|
|
1497
|
-
return
|
|
1496
|
+
async function Rr(e, t) {
|
|
1497
|
+
return U({
|
|
1498
1498
|
apiMethod: (t) => R(() => e.getProjects(t)),
|
|
1499
1499
|
args: t ? { folderId: t } : {},
|
|
1500
1500
|
limit: D.PROJECTS_MAX
|
|
1501
1501
|
});
|
|
1502
1502
|
}
|
|
1503
|
-
async function
|
|
1503
|
+
async function zr(e) {
|
|
1504
1504
|
let t = await R(() => e.getWorkspaces());
|
|
1505
|
-
return (await Promise.all(t.map((t) =>
|
|
1505
|
+
return (await Promise.all(t.map((t) => U({
|
|
1506
1506
|
apiMethod: (t) => R(() => e.getWorkspaceActiveProjects(t)),
|
|
1507
1507
|
args: { workspaceId: t.id },
|
|
1508
1508
|
limit: D.PROJECTS_MAX
|
|
1509
1509
|
})))).flat().filter((e) => e.role === null);
|
|
1510
1510
|
}
|
|
1511
|
-
async function
|
|
1511
|
+
async function W(e, t, n = () => zr(e)) {
|
|
1512
1512
|
try {
|
|
1513
1513
|
return await e.getProject(t);
|
|
1514
1514
|
} catch (e) {
|
|
1515
|
-
throw pn(e) === 404 ? await
|
|
1515
|
+
throw pn(e) === 404 ? await Vr(t, n) : e;
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
|
-
function
|
|
1519
|
-
let t = /* @__PURE__ */ new Map(), n, r = () => n ??=
|
|
1518
|
+
function Br(e) {
|
|
1519
|
+
let t = /* @__PURE__ */ new Map(), n, r = () => n ??= zr(e);
|
|
1520
1520
|
return (n) => {
|
|
1521
1521
|
let i = t.get(n);
|
|
1522
|
-
return i || (i = R(() =>
|
|
1522
|
+
return i || (i = R(() => W(e, n, r)), t.set(n, i)), i;
|
|
1523
1523
|
};
|
|
1524
1524
|
}
|
|
1525
|
-
async function
|
|
1525
|
+
async function Vr(e, t) {
|
|
1526
1526
|
let n;
|
|
1527
1527
|
try {
|
|
1528
1528
|
n = (await t()).find((t) => t.id === e);
|
|
@@ -1531,21 +1531,21 @@ async function Br(e, t) {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
return n ? new ot(`Project ${e} ("${n.name}") is a workspace project the user hasn't joined, so it can't be read yet. Ask the user whether to join it. If they agree, join it with ${B.PROJECT_MANAGEMENT} (action: "join"), then retry.`) : new ot(`Project ${e} was not found. It isn't one of the user's projects or a workspace project they can join: the ID may be wrong, the project may have been archived or deleted, or it may be restricted to people who were invited.`);
|
|
1533
1533
|
}
|
|
1534
|
-
async function
|
|
1535
|
-
return
|
|
1534
|
+
async function Hr(e) {
|
|
1535
|
+
return U({
|
|
1536
1536
|
apiMethod: e.getArchivedProjects.bind(e),
|
|
1537
1537
|
args: {},
|
|
1538
1538
|
limit: D.PROJECTS_MAX
|
|
1539
1539
|
});
|
|
1540
1540
|
}
|
|
1541
|
-
async function
|
|
1542
|
-
return
|
|
1541
|
+
async function Ur(e, t) {
|
|
1542
|
+
return U({
|
|
1543
1543
|
apiMethod: e.getArchivedSections.bind(e),
|
|
1544
1544
|
args: { projectId: t },
|
|
1545
1545
|
limit: D.SECTIONS_MAX
|
|
1546
1546
|
});
|
|
1547
1547
|
}
|
|
1548
|
-
function
|
|
1548
|
+
function Wr(e) {
|
|
1549
1549
|
let t = [""], n = [...e];
|
|
1550
1550
|
for (let e = 0; e < n.length; e++) {
|
|
1551
1551
|
let r = n[e], i = n[e + 1];
|
|
@@ -1571,29 +1571,29 @@ function Ur(e) {
|
|
|
1571
1571
|
return !0;
|
|
1572
1572
|
} };
|
|
1573
1573
|
}
|
|
1574
|
-
async function
|
|
1575
|
-
return
|
|
1574
|
+
async function Gr(e, t) {
|
|
1575
|
+
return U({
|
|
1576
1576
|
apiMethod: e.searchLabels.bind(e),
|
|
1577
|
-
args: { query:
|
|
1577
|
+
args: { query: Ir(t) },
|
|
1578
1578
|
limit: D.LABELS_MAX
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
|
-
async function
|
|
1582
|
-
return (await
|
|
1581
|
+
async function Kr(e) {
|
|
1582
|
+
return (await U({
|
|
1583
1583
|
apiMethod: e.getLabels.bind(e),
|
|
1584
1584
|
limit: D.LABELS_MAX
|
|
1585
1585
|
})).map((e) => e.name);
|
|
1586
1586
|
}
|
|
1587
|
-
async function
|
|
1588
|
-
return
|
|
1587
|
+
async function qr(e) {
|
|
1588
|
+
return U({
|
|
1589
1589
|
apiMethod: e.getSharedLabels.bind(e),
|
|
1590
1590
|
args: {},
|
|
1591
1591
|
limit: D.LABELS_MAX
|
|
1592
1592
|
});
|
|
1593
1593
|
}
|
|
1594
|
-
async function
|
|
1595
|
-
let r =
|
|
1596
|
-
return
|
|
1594
|
+
async function Jr(e, t, n) {
|
|
1595
|
+
let r = Ir(t);
|
|
1596
|
+
return U({
|
|
1597
1597
|
apiMethod: e.searchSections.bind(e),
|
|
1598
1598
|
args: n ? {
|
|
1599
1599
|
query: r,
|
|
@@ -1602,7 +1602,7 @@ async function qr(e, t, n) {
|
|
|
1602
1602
|
limit: D.SECTIONS_MAX
|
|
1603
1603
|
});
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1605
|
+
function G(e) {
|
|
1606
1606
|
return {
|
|
1607
1607
|
id: e.id,
|
|
1608
1608
|
content: e.content,
|
|
@@ -1624,7 +1624,7 @@ function K(e) {
|
|
|
1624
1624
|
addedAt: e.addedAt?.toISOString() ?? void 0
|
|
1625
1625
|
};
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function Yr(e) {
|
|
1628
1628
|
return {
|
|
1629
1629
|
id: e.id,
|
|
1630
1630
|
name: e.name,
|
|
@@ -1642,7 +1642,7 @@ function Jr(e) {
|
|
|
1642
1642
|
isArchived: e.isArchived
|
|
1643
1643
|
};
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function Xr(e) {
|
|
1646
1646
|
return {
|
|
1647
1647
|
id: e.id,
|
|
1648
1648
|
taskId: e.taskId ?? void 0,
|
|
@@ -1667,7 +1667,7 @@ function Yr(e) {
|
|
|
1667
1667
|
} : void 0
|
|
1668
1668
|
};
|
|
1669
1669
|
}
|
|
1670
|
-
function
|
|
1670
|
+
function Zr(e) {
|
|
1671
1671
|
return {
|
|
1672
1672
|
id: e.id ?? void 0,
|
|
1673
1673
|
objectType: e.objectType,
|
|
@@ -1680,7 +1680,7 @@ function Xr(e) {
|
|
|
1680
1680
|
extraData: e.extraData ?? void 0
|
|
1681
1681
|
};
|
|
1682
1682
|
}
|
|
1683
|
-
var
|
|
1683
|
+
var Qr = d.object({
|
|
1684
1684
|
httpStatusCode: d.number(),
|
|
1685
1685
|
responseData: d.object({
|
|
1686
1686
|
error: d.string(),
|
|
@@ -1688,11 +1688,11 @@ var Zr = d.object({
|
|
|
1688
1688
|
errorTag: d.string()
|
|
1689
1689
|
})
|
|
1690
1690
|
});
|
|
1691
|
-
function
|
|
1691
|
+
function $r(e) {
|
|
1692
1692
|
let t = e?.trim();
|
|
1693
1693
|
return t && t !== "0" ? e : void 0;
|
|
1694
1694
|
}
|
|
1695
|
-
async function
|
|
1695
|
+
async function ei({ client: e, query: t, limit: n, cursor: r }) {
|
|
1696
1696
|
try {
|
|
1697
1697
|
let { results: i, nextCursor: a } = await e.getTasksByFilter({
|
|
1698
1698
|
query: t,
|
|
@@ -1700,17 +1700,17 @@ async function $r({ client: e, query: t, limit: n, cursor: r }) {
|
|
|
1700
1700
|
limit: n
|
|
1701
1701
|
});
|
|
1702
1702
|
return {
|
|
1703
|
-
tasks: i.map(
|
|
1703
|
+
tasks: i.map(G),
|
|
1704
1704
|
nextCursor: a
|
|
1705
1705
|
};
|
|
1706
1706
|
} catch (e) {
|
|
1707
|
-
let n =
|
|
1707
|
+
let n = Qr.safeParse(e);
|
|
1708
1708
|
if (!n.success) throw e;
|
|
1709
1709
|
let { responseData: r } = n.data;
|
|
1710
1710
|
throw r.errorTag === "INVALID_SEARCH_QUERY" ? Error(`Invalid filter query: ${t}`) : Error(`${r.error} (tag: ${r.errorTag}, code: ${r.errorCode})`);
|
|
1711
1711
|
}
|
|
1712
1712
|
}
|
|
1713
|
-
function
|
|
1713
|
+
function ti(e) {
|
|
1714
1714
|
return {
|
|
1715
1715
|
isRecurring: e.isRecurring,
|
|
1716
1716
|
string: e.string,
|
|
@@ -1719,7 +1719,7 @@ function ei(e) {
|
|
|
1719
1719
|
timezone: e.timezone ?? void 0
|
|
1720
1720
|
};
|
|
1721
1721
|
}
|
|
1722
|
-
function
|
|
1722
|
+
function ni(e) {
|
|
1723
1723
|
let t = {
|
|
1724
1724
|
id: e.id,
|
|
1725
1725
|
taskId: e.itemId,
|
|
@@ -1730,12 +1730,12 @@ function ti(e) {
|
|
|
1730
1730
|
case "relative": return {
|
|
1731
1731
|
...t,
|
|
1732
1732
|
minuteOffset: e.minuteOffset,
|
|
1733
|
-
due: e.due ?
|
|
1733
|
+
due: e.due ? ti(e.due) : void 0,
|
|
1734
1734
|
isUrgent: e.isUrgent
|
|
1735
1735
|
};
|
|
1736
1736
|
case "absolute": return {
|
|
1737
1737
|
...t,
|
|
1738
|
-
due:
|
|
1738
|
+
due: ti(e.due),
|
|
1739
1739
|
isUrgent: e.isUrgent
|
|
1740
1740
|
};
|
|
1741
1741
|
case "location": return {
|
|
@@ -1748,29 +1748,29 @@ function ti(e) {
|
|
|
1748
1748
|
};
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
|
-
function
|
|
1751
|
+
function ri(e) {
|
|
1752
1752
|
return {
|
|
1753
1753
|
timeBasedCount: e.filter((e) => e.type === "relative" || e.type === "absolute").length,
|
|
1754
1754
|
locationCount: e.filter((e) => e.type === "location").length
|
|
1755
1755
|
};
|
|
1756
1756
|
}
|
|
1757
1757
|
// src/utils/comment-recipients.ts
|
|
1758
|
-
var
|
|
1759
|
-
function
|
|
1758
|
+
var ii = "none";
|
|
1759
|
+
function ai(e) {
|
|
1760
1760
|
return e.length === 1 && e[0]?.trim().toLowerCase() === "none";
|
|
1761
1761
|
}
|
|
1762
|
-
async function
|
|
1763
|
-
let i = await
|
|
1764
|
-
if (i) return
|
|
1762
|
+
async function oi(e, t, n, r = (t) => e.getTask(t)) {
|
|
1763
|
+
let i = await si(e, t);
|
|
1764
|
+
if (i) return ci([...i.uidsToNotify ?? [], i.postedUid], n);
|
|
1765
1765
|
if (!t.taskId) return [];
|
|
1766
1766
|
let a = await r(t.taskId);
|
|
1767
|
-
return
|
|
1767
|
+
return ci([
|
|
1768
1768
|
a.responsibleUid,
|
|
1769
1769
|
a.assignedByUid,
|
|
1770
1770
|
a.addedByUid
|
|
1771
1771
|
], n);
|
|
1772
1772
|
}
|
|
1773
|
-
async function
|
|
1773
|
+
async function si(e, t) {
|
|
1774
1774
|
let n, r = null;
|
|
1775
1775
|
do {
|
|
1776
1776
|
let i = await e.getComments({
|
|
@@ -1782,24 +1782,24 @@ async function oi(e, t) {
|
|
|
1782
1782
|
} while (r);
|
|
1783
1783
|
return n;
|
|
1784
1784
|
}
|
|
1785
|
-
function
|
|
1785
|
+
function ci(e, t) {
|
|
1786
1786
|
let n = /* @__PURE__ */ new Set();
|
|
1787
1787
|
for (let r of e) r && r !== t && n.add(r);
|
|
1788
1788
|
return [...n];
|
|
1789
1789
|
}
|
|
1790
1790
|
// src/utils/colors.ts
|
|
1791
|
-
var
|
|
1792
|
-
function
|
|
1791
|
+
var li = ie.map((e) => e.key);
|
|
1792
|
+
function ui(e) {
|
|
1793
1793
|
if (typeof e != "string") return;
|
|
1794
1794
|
let t = e.toLowerCase();
|
|
1795
1795
|
return (ie.find((e) => e.key === t) ?? ie.find((e) => e.displayName.toLowerCase() === t))?.key;
|
|
1796
1796
|
}
|
|
1797
|
-
var
|
|
1798
|
-
function
|
|
1799
|
-
return
|
|
1797
|
+
var di = `Color for the entity. Accepts a color key (e.g. "berry_red") or display name (e.g. "Berry Red"). Valid colors: ${li.join(", ")}. `, fi = di + "Unrecognized colors are omitted and charcoal will be used as the default.", pi = p.preprocess(ui, p.enum(li).optional()).describe(fi);
|
|
1798
|
+
function mi(e) {
|
|
1799
|
+
return pi.describe(di + e);
|
|
1800
1800
|
}
|
|
1801
|
-
p.enum(
|
|
1802
|
-
var
|
|
1801
|
+
p.enum(li);
|
|
1802
|
+
var K = p.enum(li).optional().catch(void 0), q = p.object({
|
|
1803
1803
|
id: p.string(),
|
|
1804
1804
|
content: p.string().describe("Task title."),
|
|
1805
1805
|
description: p.string(),
|
|
@@ -1819,11 +1819,11 @@ var q = p.enum(ci).optional().catch(void 0), J = p.object({
|
|
|
1819
1819
|
checked: p.boolean().describe("Whether the task is completed."),
|
|
1820
1820
|
completedAt: p.string().optional().describe("ISO 8601."),
|
|
1821
1821
|
addedAt: p.string().optional().describe("ISO 8601.")
|
|
1822
|
-
}),
|
|
1822
|
+
}), hi = p.object({
|
|
1823
1823
|
id: p.string(),
|
|
1824
1824
|
name: p.string(),
|
|
1825
1825
|
description: p.string().describe("Empty string when none."),
|
|
1826
|
-
color:
|
|
1826
|
+
color: K,
|
|
1827
1827
|
icon: p.string().optional(),
|
|
1828
1828
|
isFavorite: p.boolean(),
|
|
1829
1829
|
isShared: p.boolean(),
|
|
@@ -1834,13 +1834,13 @@ var q = p.enum(ci).optional().catch(void 0), J = p.object({
|
|
|
1834
1834
|
folderId: p.string().optional().describe("Workspace projects only."),
|
|
1835
1835
|
childOrder: p.number().describe("Ordering index among siblings."),
|
|
1836
1836
|
isArchived: p.boolean()
|
|
1837
|
-
}),
|
|
1837
|
+
}), gi = p.object({
|
|
1838
1838
|
id: p.string(),
|
|
1839
1839
|
name: p.string(),
|
|
1840
1840
|
sectionOrder: p.number().describe("Ordering index within the project."),
|
|
1841
1841
|
description: p.string().optional().describe("Supports Markdown.")
|
|
1842
1842
|
});
|
|
1843
|
-
function
|
|
1843
|
+
function _i({ id: e, name: t, sectionOrder: n, description: r }) {
|
|
1844
1844
|
return {
|
|
1845
1845
|
id: e,
|
|
1846
1846
|
name: t,
|
|
@@ -1848,19 +1848,19 @@ function gi({ id: e, name: t, sectionOrder: n, description: r }) {
|
|
|
1848
1848
|
description: r ?? void 0
|
|
1849
1849
|
};
|
|
1850
1850
|
}
|
|
1851
|
-
var
|
|
1851
|
+
var vi = p.object({
|
|
1852
1852
|
id: p.string(),
|
|
1853
1853
|
name: p.string(),
|
|
1854
1854
|
workspaceId: p.string()
|
|
1855
1855
|
});
|
|
1856
|
-
function
|
|
1856
|
+
function yi({ id: e, name: t, workspaceId: n }) {
|
|
1857
1857
|
return {
|
|
1858
1858
|
id: e,
|
|
1859
1859
|
name: t,
|
|
1860
1860
|
workspaceId: n
|
|
1861
1861
|
};
|
|
1862
1862
|
}
|
|
1863
|
-
var
|
|
1863
|
+
var bi = p.object({
|
|
1864
1864
|
resourceType: p.string().describe("file, url, image, etc."),
|
|
1865
1865
|
fileName: p.string().optional(),
|
|
1866
1866
|
fileSize: p.number().optional().describe("Bytes."),
|
|
@@ -1873,7 +1873,7 @@ var yi = p.object({
|
|
|
1873
1873
|
image: p.string().optional().describe("For image resource types."),
|
|
1874
1874
|
imageWidth: p.number().optional().describe("Pixels."),
|
|
1875
1875
|
imageHeight: p.number().optional().describe("Pixels.")
|
|
1876
|
-
}),
|
|
1876
|
+
}), xi = p.object({
|
|
1877
1877
|
id: p.string(),
|
|
1878
1878
|
taskId: p.string().optional(),
|
|
1879
1879
|
projectId: p.string().optional(),
|
|
@@ -1881,8 +1881,8 @@ var yi = p.object({
|
|
|
1881
1881
|
postedAt: p.string().describe("ISO 8601."),
|
|
1882
1882
|
postedUid: p.string().optional(),
|
|
1883
1883
|
notifiedUserIds: p.array(p.string()).optional().describe("Users notified about this comment. Absent when nobody was notified."),
|
|
1884
|
-
fileAttachment:
|
|
1885
|
-
}),
|
|
1884
|
+
fileAttachment: bi.optional()
|
|
1885
|
+
}), Si = p.object({
|
|
1886
1886
|
id: p.string().optional(),
|
|
1887
1887
|
objectType: p.string().describe("task, project, etc."),
|
|
1888
1888
|
objectId: p.string(),
|
|
@@ -1892,53 +1892,53 @@ var yi = p.object({
|
|
|
1892
1892
|
parentItemId: p.string().optional(),
|
|
1893
1893
|
initiatorId: p.string().optional().describe("User who initiated the event."),
|
|
1894
1894
|
extraData: p.record(p.string(), p.unknown()).optional()
|
|
1895
|
-
}),
|
|
1895
|
+
}), Ci = p.object({
|
|
1896
1896
|
id: p.string(),
|
|
1897
1897
|
name: p.string(),
|
|
1898
1898
|
email: p.string()
|
|
1899
|
-
}),
|
|
1899
|
+
}), wi = p.object({
|
|
1900
1900
|
id: p.string(),
|
|
1901
1901
|
name: p.string(),
|
|
1902
|
-
color:
|
|
1902
|
+
color: K,
|
|
1903
1903
|
order: p.number().optional().catch(void 0).describe("Display order."),
|
|
1904
1904
|
isFavorite: p.boolean()
|
|
1905
|
-
}),
|
|
1905
|
+
}), Ti = p.object({
|
|
1906
1906
|
isRecurring: p.boolean(),
|
|
1907
1907
|
string: p.string().describe("Human-readable due string."),
|
|
1908
1908
|
date: p.string().describe("ISO 8601."),
|
|
1909
1909
|
datetime: p.string().optional().describe("ISO 8601."),
|
|
1910
1910
|
timezone: p.string().optional()
|
|
1911
|
-
}),
|
|
1911
|
+
}), Ei = p.object({
|
|
1912
1912
|
id: p.string(),
|
|
1913
1913
|
taskId: p.string(),
|
|
1914
1914
|
type: p.enum(ee),
|
|
1915
1915
|
notifyUid: p.string().optional().describe("User ID the reminder notifies."),
|
|
1916
1916
|
minuteOffset: p.number().optional().describe("Minutes before due. Relative reminders only."),
|
|
1917
|
-
due:
|
|
1917
|
+
due: Ti.optional().describe("Absolute, and sometimes relative, reminders."),
|
|
1918
1918
|
name: p.string().optional().describe("Location name. Location reminders only."),
|
|
1919
1919
|
locLat: p.string().optional().describe("Location reminders only."),
|
|
1920
1920
|
locLong: p.string().optional().describe("Location reminders only."),
|
|
1921
1921
|
locTrigger: p.enum(y).optional().describe("Location reminders only."),
|
|
1922
1922
|
radius: p.number().optional().describe("Geofence radius in metres. Location reminders only."),
|
|
1923
1923
|
isUrgent: p.boolean().optional().describe("Relative and absolute reminders only.")
|
|
1924
|
-
}),
|
|
1924
|
+
}), J = p.object({
|
|
1925
1925
|
item: p.string().describe("Usually the ID of the item that failed."),
|
|
1926
1926
|
error: p.string(),
|
|
1927
1927
|
code: p.string().optional(),
|
|
1928
1928
|
retryAfterSeconds: p.number().nonnegative().optional()
|
|
1929
|
-
}),
|
|
1929
|
+
}), Di = {
|
|
1930
1930
|
source: p.enum(["todoist", "user"]).describe("todoist for gallery templates, user for saved ones."),
|
|
1931
1931
|
workspaceId: p.string().optional().describe("Absent for personal and gallery templates.")
|
|
1932
1932
|
};
|
|
1933
1933
|
// src/utils/response-builders.ts
|
|
1934
|
-
function
|
|
1934
|
+
function Oi(e = /* @__PURE__ */ new Date()) {
|
|
1935
1935
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
1936
1936
|
}
|
|
1937
|
-
var { FIND_TASKS_BY_DATE:
|
|
1938
|
-
function
|
|
1937
|
+
var { FIND_TASKS_BY_DATE: ki, ADD_TASKS: Ai, UPDATE_TASKS: ji, COMPLETE_TASKS: Mi, GET_OVERVIEW: Ni } = B;
|
|
1938
|
+
function Pi(e, t, n = {}) {
|
|
1939
1939
|
let { context: r, showDetails: i = !1 } = n, a = t.length, o = [], s = `${e} ${a} ${a === 1 ? "task" : "tasks"}${r ? ` ${r}` : ""}.`;
|
|
1940
1940
|
if (o.push(s), i || a <= 5) {
|
|
1941
|
-
let e =
|
|
1941
|
+
let e = zi(t, 5);
|
|
1942
1942
|
if (e.length > 0) {
|
|
1943
1943
|
let t = a > 5 ? `, +${a - 5} more` : "";
|
|
1944
1944
|
o.push(`Tasks:\n${e}${t}.`);
|
|
@@ -1946,7 +1946,7 @@ function Ni(e, t, n = {}) {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
return o.join("\n");
|
|
1948
1948
|
}
|
|
1949
|
-
function
|
|
1949
|
+
function Fi(e) {
|
|
1950
1950
|
let { action: t, success: n, total: r, successItems: i, successLabel: a = "Completed", failures: o } = e, s = [], c = `${t}: ${n}/${r} successful.`;
|
|
1951
1951
|
if (s.push(c), i?.length && i.length <= 5 && s.push(`${a}:\n${i.map((e) => ` ${e}`).join("\n")}.`), o?.length) {
|
|
1952
1952
|
let e = o.length, t = `Failed (${e}):\n${o.slice(0, be.MAX_FAILURES_SHOWN).map((e) => ` ${e.item} (Error: ${e.error}${e.code ? ` [${e.code}]` : ""})`).join("\n")}${e > be.MAX_FAILURES_SHOWN ? `, +${e - be.MAX_FAILURES_SHOWN} more` : ""}.`;
|
|
@@ -1954,57 +1954,57 @@ function Pi(e) {
|
|
|
1954
1954
|
}
|
|
1955
1955
|
return s.join("\n");
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1957
|
+
function Y(e, t) {
|
|
1958
1958
|
if (t.length === 0) return e;
|
|
1959
1959
|
let n = t.slice(0, be.MAX_FAILURES_SHOWN), r = t.length - n.length, i = n.map((e) => ` ${e.item}: ${e.error}`).join("\n"), a = r > 0 ? `\n +${r} more` : "";
|
|
1960
1960
|
return `${e}\nFailed (${t.length}) - address or drop these items:\n${i}${a}`;
|
|
1961
1961
|
}
|
|
1962
|
-
function
|
|
1962
|
+
function Ii(e, t) {
|
|
1963
1963
|
return ` ${e.content || e.title || "Untitled"}${e.dueDate ? ` • due ${e.dueDate}` : ""}${e.priority ? ` • ${e.priority.toUpperCase()}` : ""}${e.projectName ? ` • ${e.projectName}` : ""}${t && e.responsibleUid ? ` • +${t.get(e.responsibleUid) ?? e.responsibleUid}` : ""}${e.id ? ` • id=${e.id}` : ""}`;
|
|
1964
1964
|
}
|
|
1965
|
-
function
|
|
1965
|
+
function Li(e) {
|
|
1966
1966
|
let t = ` (${e.color})`, n = e.isFavorite ? " • ⭐" : "", r = ` • id=${e.id}`;
|
|
1967
1967
|
return ` ${e.name}${t}${n}${r}`;
|
|
1968
1968
|
}
|
|
1969
|
-
function
|
|
1969
|
+
function Ri(e) {
|
|
1970
1970
|
let t = e.inboxProject ? " • Inbox" : "", n = e.isFavorite ? " • ⭐" : "", r = e.isShared ? " • Shared" : "", i = e.isArchived ? " • Archived" : "", a = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", o = ` • id=${e.id}`;
|
|
1971
1971
|
return ` ${e.name}${t}${n}${r}${i}${a}${o}`;
|
|
1972
1972
|
}
|
|
1973
|
-
function
|
|
1974
|
-
let r = e.slice(0, t).map((e) =>
|
|
1973
|
+
function zi(e, t = 5, n) {
|
|
1974
|
+
let r = e.slice(0, t).map((e) => Ii(e, n)).join("\n");
|
|
1975
1975
|
if (e.length > t) {
|
|
1976
1976
|
let n = e.length - t;
|
|
1977
1977
|
return `${r}\n ... and ${n} more task${n === 1 ? "" : "s"}`;
|
|
1978
1978
|
}
|
|
1979
1979
|
return r;
|
|
1980
1980
|
}
|
|
1981
|
-
function
|
|
1981
|
+
function X({ subject: e, count: t, limit: n, nextCursor: r, filterHints: i, notes: a, previewLines: o, zeroReasonHints: s, nextSteps: c }) {
|
|
1982
1982
|
let l = [], u = `${e}: ${t}${typeof n == "number" ? ` (limit ${n})` : ""}${r ? ", more available" : ""}.`;
|
|
1983
|
-
return l.push(u), i?.length && l.push(`Filter: ${i.join("; ")}.`), a?.length && l.push(...a), o?.length && l.push(`Preview:\n${o}`), !t && s?.length && l.push(`No results. ${s.join("; ")}.`), (c?.length || r) && l.push(
|
|
1983
|
+
return l.push(u), i?.length && l.push(`Filter: ${i.join("; ")}.`), a?.length && l.push(...a), o?.length && l.push(`Preview:\n${o}`), !t && s?.length && l.push(`No results. ${s.join("; ")}.`), (c?.length || r) && l.push(Bi(c || [], r)), l.join("\n");
|
|
1984
1984
|
}
|
|
1985
|
-
function
|
|
1985
|
+
function Bi(e, t) {
|
|
1986
1986
|
let n = [...e];
|
|
1987
1987
|
return t && n.push(`Pass cursor '${t}' to fetch more results.`), `${n.length === 1 ? "Possible suggested next step:" : "Possible suggested next steps:"}\n${n.map((e) => `- ${e}`).join("\n")}`;
|
|
1988
1988
|
}
|
|
1989
1989
|
// src/tools/add-comments.ts
|
|
1990
|
-
var
|
|
1990
|
+
var Vi = p.object({
|
|
1991
1991
|
taskId: p.string().optional().describe("The ID of the task to comment on."),
|
|
1992
1992
|
projectId: p.string().optional().describe("The ID of the project to comment on. Project ID should be an ID string, or the text \"inbox\", for inbox tasks."),
|
|
1993
1993
|
content: p.string().min(1).describe("The content of the comment."),
|
|
1994
|
-
notifyUsers: p.array(p.string().min(1)).min(1).max(D.NOTIFY_USERS_MAX).optional().describe(`Who to notify about this comment — a user ID, email, full name, or "me" for each person. Set this whenever the comment mentions someone; the text of an @mention notifies nobody on its own. Omit to notify whoever the Todoist apps would (the task's assignee, assigner and creator on a first comment, or the previous comment's participants on a reply). Pass ["${
|
|
1995
|
-
}),
|
|
1996
|
-
comments: p.array(
|
|
1994
|
+
notifyUsers: p.array(p.string().min(1)).min(1).max(D.NOTIFY_USERS_MAX).optional().describe(`Who to notify about this comment — a user ID, email, full name, or "me" for each person. Set this whenever the comment mentions someone; the text of an @mention notifies nobody on its own. Omit to notify whoever the Todoist apps would (the task's assignee, assigner and creator on a first comment, or the previous comment's participants on a reply). Pass ["${ii}"] to notify nobody.`)
|
|
1995
|
+
}), Hi = { comments: p.array(Vi).min(1).max(O.ITEMS_PER_OPERATION).describe("The array of comments to add.") }, Ui = {
|
|
1996
|
+
comments: p.array(xi).describe("The created comments."),
|
|
1997
1997
|
totalCount: p.number().describe("The total number of comments created."),
|
|
1998
1998
|
addedCommentIds: p.array(p.string()).describe("The IDs of the added comments."),
|
|
1999
|
-
failures: p.array(
|
|
1999
|
+
failures: p.array(J).describe("Comments that could not be added, identified by their content, with the reason for each."),
|
|
2000
2000
|
totalRequested: p.number(),
|
|
2001
2001
|
successCount: p.number(),
|
|
2002
2002
|
failureCount: p.number()
|
|
2003
|
-
},
|
|
2003
|
+
}, Wi = {
|
|
2004
2004
|
name: B.ADD_COMMENTS,
|
|
2005
2005
|
description: "Add multiple comments to tasks or projects, optionally notifying collaborators. Each comment must specify either taskId or projectId.",
|
|
2006
|
-
parameters:
|
|
2007
|
-
outputSchema:
|
|
2006
|
+
parameters: Hi,
|
|
2007
|
+
outputSchema: Ui,
|
|
2008
2008
|
annotations: {
|
|
2009
2009
|
readOnlyHint: !1,
|
|
2010
2010
|
destructiveHint: !1,
|
|
@@ -2019,12 +2019,12 @@ var Bi = p.object({
|
|
|
2019
2019
|
}
|
|
2020
2020
|
let s = /* @__PURE__ */ new Map();
|
|
2021
2021
|
async function c({ notifyUsers: e }, n) {
|
|
2022
|
-
if (e) return
|
|
2022
|
+
if (e) return ai(e) ? [] : (await R(() => Or(t, e))).map((e) => e.userId);
|
|
2023
2023
|
let { id: r } = await i(), a = n.taskId ? `task:${n.taskId}` : `project:${n.projectId}`, c = s.get(a);
|
|
2024
|
-
return c || (c =
|
|
2024
|
+
return c || (c = oi(t, n, r, o), s.set(a, c)), await c;
|
|
2025
2025
|
}
|
|
2026
2026
|
let l = await Promise.allSettled(n.map(async (e) => {
|
|
2027
|
-
let t = await
|
|
2027
|
+
let t = await Gi(e, i);
|
|
2028
2028
|
return {
|
|
2029
2029
|
target: t,
|
|
2030
2030
|
uidsToNotify: await c(e, t)
|
|
@@ -2040,11 +2040,11 @@ var Bi = p.object({
|
|
|
2040
2040
|
noun: "comment",
|
|
2041
2041
|
findWith: B.FIND_COMMENTS
|
|
2042
2042
|
});
|
|
2043
|
-
})), (e) => e.content), f = u.map(({ value: e }) =>
|
|
2043
|
+
})), (e) => e.content), f = u.map(({ value: e }) => Xr(e));
|
|
2044
2044
|
return L(B.ADD_COMMENTS, n.length, d, { redactItems: !0 }), {
|
|
2045
|
-
textContent:
|
|
2045
|
+
textContent: Y(qi({
|
|
2046
2046
|
comments: f,
|
|
2047
|
-
notifiedNames: await
|
|
2047
|
+
notifiedNames: await Ki(t, f, {
|
|
2048
2048
|
getTask: o,
|
|
2049
2049
|
getCurrentUser: i
|
|
2050
2050
|
})
|
|
@@ -2061,21 +2061,21 @@ var Bi = p.object({
|
|
|
2061
2061
|
};
|
|
2062
2062
|
}
|
|
2063
2063
|
};
|
|
2064
|
-
async function
|
|
2064
|
+
async function Gi(e, t) {
|
|
2065
2065
|
if (!e.taskId && !e.projectId) throw Error("Either taskId or projectId must be provided.");
|
|
2066
2066
|
if (e.taskId && e.projectId) throw Error("Cannot provide both taskId and projectId. Choose one.");
|
|
2067
|
-
return e.taskId ? { taskId: e.taskId } : { projectId: await
|
|
2067
|
+
return e.taskId ? { taskId: e.taskId } : { projectId: await Fr({
|
|
2068
2068
|
projectId: e.projectId,
|
|
2069
|
-
user:
|
|
2069
|
+
user: Pr(e.projectId) ? await t() : void 0
|
|
2070
2070
|
}) };
|
|
2071
2071
|
}
|
|
2072
|
-
async function
|
|
2072
|
+
async function Ki(e, t, { getTask: n, getCurrentUser: r }) {
|
|
2073
2073
|
let i = t.filter((e) => e.notifiedUserIds);
|
|
2074
2074
|
if (i.length === 0) return /* @__PURE__ */ new Map();
|
|
2075
2075
|
let a = await Promise.allSettled(i.flatMap(({ projectId: e, taskId: t }) => e ? [Promise.resolve(e)] : t ? [n(t).then((e) => e.projectId)] : [])), o = await r().then((e) => e.id, () => null);
|
|
2076
2076
|
return H.getUserShortNames(e, a.flatMap((e) => e.status === "fulfilled" ? [e.value] : []), o).catch(() => /* @__PURE__ */ new Map());
|
|
2077
2077
|
}
|
|
2078
|
-
function
|
|
2078
|
+
function qi({ comments: e, notifiedNames: t }) {
|
|
2079
2079
|
let n = e.filter((e) => e.taskId).length, r = e.filter((e) => e.projectId).length, i = [];
|
|
2080
2080
|
if (n > 0) {
|
|
2081
2081
|
let e = n > 1 ? "comments" : "comment";
|
|
@@ -2089,15 +2089,15 @@ function Ki({ comments: e, notifiedNames: t }) {
|
|
|
2089
2089
|
return o.length === 0 ? a : `${a}. Notified: ${o.map((e) => t.get(e) ?? e).join(", ")}`;
|
|
2090
2090
|
}
|
|
2091
2091
|
// src/utils/schema-helpers.ts
|
|
2092
|
-
function
|
|
2092
|
+
function Z(e) {
|
|
2093
2093
|
return p.string().transform((e) => e === "" ? void 0 : e).optional().describe(e);
|
|
2094
2094
|
}
|
|
2095
2095
|
// src/utils/sync-commands.ts
|
|
2096
|
-
var
|
|
2096
|
+
var Ji = {
|
|
2097
2097
|
status: "fulfilled",
|
|
2098
2098
|
value: void 0
|
|
2099
2099
|
};
|
|
2100
|
-
async function
|
|
2100
|
+
async function Q(e, t, { limit: n = (e) => e(), created: r } = {}) {
|
|
2101
2101
|
let i, a, o = !1;
|
|
2102
2102
|
async function s() {
|
|
2103
2103
|
try {
|
|
@@ -2126,7 +2126,7 @@ async function $(e, t, { limit: n = (e) => e(), created: r } = {}) {
|
|
|
2126
2126
|
return {
|
|
2127
2127
|
outcomes: t.map((e) => {
|
|
2128
2128
|
let t = i[e.uuid];
|
|
2129
|
-
return t === "ok" ?
|
|
2129
|
+
return t === "ok" ? Ji : t === void 0 ? {
|
|
2130
2130
|
status: "rejected",
|
|
2131
2131
|
reason: /* @__PURE__ */ Error("Todoist did not report whether this change was applied")
|
|
2132
2132
|
} : {
|
|
@@ -2139,26 +2139,26 @@ async function $(e, t, { limit: n = (e) => e(), created: r } = {}) {
|
|
|
2139
2139
|
};
|
|
2140
2140
|
}
|
|
2141
2141
|
// src/utils/filter-description.ts
|
|
2142
|
-
function
|
|
2142
|
+
function Yi(e) {
|
|
2143
2143
|
return e.description || void 0;
|
|
2144
2144
|
}
|
|
2145
2145
|
// src/tools/find-filters.ts
|
|
2146
|
-
var
|
|
2146
|
+
var Xi = { search: p.string().optional().describe("Search for a filter by name (partial and case insensitive match). If omitted, all filters are returned.") }, Zi = p.object({
|
|
2147
2147
|
id: p.string().describe("The unique ID of the filter."),
|
|
2148
2148
|
name: p.string().describe("The name of the filter."),
|
|
2149
2149
|
query: p.string().describe("The filter query string (e.g. \"today & p1\", \"#Work & overdue\")."),
|
|
2150
2150
|
description: p.string().optional().describe("A markdown description explaining what the filter is for. Omitted when the filter has none."),
|
|
2151
|
-
color:
|
|
2151
|
+
color: K,
|
|
2152
2152
|
isFavorite: p.boolean().describe("Whether the filter is marked as favorite."),
|
|
2153
2153
|
itemOrder: p.number().describe("The display order of the filter.")
|
|
2154
|
-
}),
|
|
2155
|
-
filters: p.array(
|
|
2154
|
+
}), Qi = {
|
|
2155
|
+
filters: p.array(Zi).describe("The found filters."),
|
|
2156
2156
|
totalCount: p.number().describe("The total number of filters returned.")
|
|
2157
|
-
},
|
|
2157
|
+
}, $i = {
|
|
2158
2158
|
name: B.FIND_FILTERS,
|
|
2159
2159
|
description: "List all personal filters or search for filters by name. Filters are saved custom views that use query syntax to organize tasks (e.g. \"today & p1\", \"#Work & overdue\").",
|
|
2160
|
-
parameters:
|
|
2161
|
-
outputSchema:
|
|
2160
|
+
parameters: Xi,
|
|
2161
|
+
outputSchema: Qi,
|
|
2162
2162
|
annotations: {
|
|
2163
2163
|
readOnlyHint: !0,
|
|
2164
2164
|
destructiveHint: !1,
|
|
@@ -2178,13 +2178,13 @@ var Yi = { search: p.string().optional().describe("Search for a filter by name (
|
|
|
2178
2178
|
id: e.id,
|
|
2179
2179
|
name: e.name,
|
|
2180
2180
|
query: e.query,
|
|
2181
|
-
description:
|
|
2182
|
-
color:
|
|
2181
|
+
description: Yi(e),
|
|
2182
|
+
color: K.parse(e.color),
|
|
2183
2183
|
isFavorite: e.isFavorite,
|
|
2184
2184
|
itemOrder: e.itemOrder
|
|
2185
2185
|
}));
|
|
2186
2186
|
return {
|
|
2187
|
-
textContent:
|
|
2187
|
+
textContent: ea({
|
|
2188
2188
|
filters: r,
|
|
2189
2189
|
search: e.search
|
|
2190
2190
|
}),
|
|
@@ -2195,7 +2195,7 @@ var Yi = { search: p.string().optional().describe("Search for a filter by name (
|
|
|
2195
2195
|
};
|
|
2196
2196
|
}
|
|
2197
2197
|
};
|
|
2198
|
-
function
|
|
2198
|
+
function ea({ filters: e, search: t }) {
|
|
2199
2199
|
let n = t ? `Filters matching "${t}"` : "Filters";
|
|
2200
2200
|
if (e.length === 0) return `${n}: 0 found\n\nSuggestions:\n${(t ? [
|
|
2201
2201
|
"Try broader search terms",
|
|
@@ -2210,31 +2210,31 @@ function $i({ filters: e, search: t }) {
|
|
|
2210
2210
|
return r.join("\n");
|
|
2211
2211
|
}
|
|
2212
2212
|
// src/tools/add-filters.ts
|
|
2213
|
-
var
|
|
2213
|
+
var ta = p.object({
|
|
2214
2214
|
name: p.string().min(1).describe("The name of the filter."),
|
|
2215
2215
|
query: p.string().min(1).describe("The filter query string. Examples: \"today & p1\", \"#Work & overdue\", \"@email & today\", \"(p1 | p2) & !assigned\". Operators: | (OR), & (AND), ! (NOT), () grouping, , (multiple queries)."),
|
|
2216
|
-
description:
|
|
2217
|
-
color:
|
|
2216
|
+
description: Z("A markdown description explaining what the filter is for."),
|
|
2217
|
+
color: pi,
|
|
2218
2218
|
isFavorite: p.boolean().optional().describe("Whether to mark the filter as a favorite. Defaults to false.")
|
|
2219
|
-
}),
|
|
2220
|
-
filters: p.array(
|
|
2219
|
+
}), na = { filters: p.array(ta).min(1).max(O.ITEMS_PER_OPERATION).describe("The array of filters to add.") }, ra = {
|
|
2220
|
+
filters: p.array(Zi).describe("The created filters."),
|
|
2221
2221
|
totalCount: p.number().describe("The total number of filters created."),
|
|
2222
|
-
failures: p.array(
|
|
2222
|
+
failures: p.array(J).describe("Filters that could not be created, with the reason for each."),
|
|
2223
2223
|
totalRequested: p.number(),
|
|
2224
2224
|
successCount: p.number(),
|
|
2225
2225
|
failureCount: p.number()
|
|
2226
|
-
},
|
|
2226
|
+
}, ia = {
|
|
2227
2227
|
name: B.ADD_FILTERS,
|
|
2228
2228
|
description: "Add one or more new personal filters. Filters are saved custom views using query syntax to organize tasks.",
|
|
2229
|
-
parameters:
|
|
2230
|
-
outputSchema:
|
|
2229
|
+
parameters: na,
|
|
2230
|
+
outputSchema: ra,
|
|
2231
2231
|
annotations: {
|
|
2232
2232
|
readOnlyHint: !1,
|
|
2233
2233
|
destructiveHint: !1,
|
|
2234
2234
|
idempotentHint: !1
|
|
2235
2235
|
},
|
|
2236
2236
|
async execute({ filters: e }, t) {
|
|
2237
|
-
let n = Date.now(), r = e.map((e, t) => `tempFilterAdd${t}${n}`), { outcomes: i, tempIdMapping: a } = await
|
|
2237
|
+
let n = Date.now(), r = e.map((e, t) => `tempFilterAdd${t}${n}`), { outcomes: i, tempIdMapping: a } = await Q(t, e.map((e, t) => T("filter_add", {
|
|
2238
2238
|
name: e.name,
|
|
2239
2239
|
query: e.query,
|
|
2240
2240
|
...e.description === void 0 ? {} : { description: e.description },
|
|
@@ -2259,14 +2259,14 @@ var ea = p.object({
|
|
|
2259
2259
|
name: e.name,
|
|
2260
2260
|
query: e.query,
|
|
2261
2261
|
...e.description ? { description: e.description } : {},
|
|
2262
|
-
color: e.color === void 0 ? void 0 :
|
|
2262
|
+
color: e.color === void 0 ? void 0 : K.parse(e.color),
|
|
2263
2263
|
isFavorite: e.isFavorite ?? !1,
|
|
2264
2264
|
itemOrder: 0
|
|
2265
2265
|
}));
|
|
2266
2266
|
L(B.ADD_FILTERS, e.length, s, { redactItems: !0 });
|
|
2267
2267
|
let l = c.length, u = c.map((e) => `• ${e.name} (id=${e.id})`).join("\n");
|
|
2268
2268
|
return {
|
|
2269
|
-
textContent:
|
|
2269
|
+
textContent: Y(l > 0 ? `Added ${l} filter${l === 1 ? "" : "s"}:\n${u}` : "Added 0 filters", s),
|
|
2270
2270
|
structuredContent: {
|
|
2271
2271
|
filters: c,
|
|
2272
2272
|
totalCount: c.length,
|
|
@@ -2277,11 +2277,11 @@ var ea = p.object({
|
|
|
2277
2277
|
}
|
|
2278
2278
|
};
|
|
2279
2279
|
}
|
|
2280
|
-
},
|
|
2281
|
-
function
|
|
2280
|
+
}, aa = 3e5;
|
|
2281
|
+
function oa(e) {
|
|
2282
2282
|
return /^\d+$/.test(e);
|
|
2283
2283
|
}
|
|
2284
|
-
var
|
|
2284
|
+
var sa = new class {
|
|
2285
2285
|
constructor() {
|
|
2286
2286
|
this.stateByClient = /* @__PURE__ */ new WeakMap();
|
|
2287
2287
|
}
|
|
@@ -2290,7 +2290,7 @@ var oa = new class {
|
|
|
2290
2290
|
if (t || (t = {
|
|
2291
2291
|
cache: null,
|
|
2292
2292
|
inFlightWorkspaces: null
|
|
2293
|
-
}, this.stateByClient.set(e, t)), t.cache && Date.now() - t.cache.timestamp <
|
|
2293
|
+
}, this.stateByClient.set(e, t)), t.cache && Date.now() - t.cache.timestamp < aa) return t.cache.workspaces;
|
|
2294
2294
|
if (t.inFlightWorkspaces) return t.inFlightWorkspaces;
|
|
2295
2295
|
let n = e.getWorkspaces().then((e) => (t.cache = {
|
|
2296
2296
|
workspaces: e,
|
|
@@ -2308,7 +2308,7 @@ var oa = new class {
|
|
|
2308
2308
|
workspaceId: i.id,
|
|
2309
2309
|
workspaceName: i.name
|
|
2310
2310
|
};
|
|
2311
|
-
if (
|
|
2311
|
+
if (oa(n)) return {
|
|
2312
2312
|
workspaceId: n,
|
|
2313
2313
|
workspaceName: n
|
|
2314
2314
|
};
|
|
@@ -2337,19 +2337,19 @@ var oa = new class {
|
|
|
2337
2337
|
clearCache() {
|
|
2338
2338
|
this.stateByClient = /* @__PURE__ */ new WeakMap();
|
|
2339
2339
|
}
|
|
2340
|
-
}(), { ADD_PROJECTS:
|
|
2340
|
+
}(), { ADD_PROJECTS: ca, LIST_WORKSPACES: la, UPDATE_PROJECTS: ua } = B, da = p.object({
|
|
2341
2341
|
name: p.string().min(1).describe("The name of the folder."),
|
|
2342
|
-
workspace: p.string().trim().min(1).describe(`The workspace to create the folder in, by name or ID (see ${
|
|
2343
|
-
}),
|
|
2344
|
-
folders: p.array(
|
|
2345
|
-
failures: p.array(
|
|
2342
|
+
workspace: p.string().trim().min(1).describe(`The workspace to create the folder in, by name or ID (see ${la}).`)
|
|
2343
|
+
}), fa = { folders: p.array(da).min(1).max(O.ITEMS_PER_OPERATION).describe("The folders to add.") }, pa = {
|
|
2344
|
+
folders: p.array(vi).describe("The created folders."),
|
|
2345
|
+
failures: p.array(J).describe("Folders that could not be created, with the reason for each."),
|
|
2346
2346
|
successCount: p.number(),
|
|
2347
2347
|
failureCount: p.number()
|
|
2348
|
-
},
|
|
2348
|
+
}, ma = {
|
|
2349
2349
|
name: B.ADD_FOLDERS,
|
|
2350
|
-
description: `Add one or more folders to group a workspace's projects. Put projects in one with ${
|
|
2351
|
-
parameters:
|
|
2352
|
-
outputSchema:
|
|
2350
|
+
description: `Add one or more folders to group a workspace's projects. Put projects in one with ${ca} or ${ua} folderId.`,
|
|
2351
|
+
parameters: fa,
|
|
2352
|
+
outputSchema: pa,
|
|
2353
2353
|
annotations: {
|
|
2354
2354
|
readOnlyHint: !1,
|
|
2355
2355
|
destructiveHint: !1,
|
|
@@ -2358,7 +2358,7 @@ var oa = new class {
|
|
|
2358
2358
|
async execute({ folders: e }, t) {
|
|
2359
2359
|
let n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
2360
2360
|
let r = n.get(e);
|
|
2361
|
-
return r || (r = R(() =>
|
|
2361
|
+
return r || (r = R(() => sa.resolveWorkspace(t, e)).then(({ workspaceId: e }) => e), n.set(e, r)), r;
|
|
2362
2362
|
}, { succeeded: i, failures: a } = I(e, await Promise.allSettled(e.map(async ({ name: e, workspace: n }) => {
|
|
2363
2363
|
let i = await r(n);
|
|
2364
2364
|
return z(() => t.addFolder({
|
|
@@ -2370,9 +2370,9 @@ var oa = new class {
|
|
|
2370
2370
|
});
|
|
2371
2371
|
})), (e) => e.name), o = i.map(({ value: e }) => e);
|
|
2372
2372
|
return L(B.ADD_FOLDERS, e.length, a, { redactItems: !0 }), {
|
|
2373
|
-
textContent:
|
|
2373
|
+
textContent: ha(o, a),
|
|
2374
2374
|
structuredContent: {
|
|
2375
|
-
folders: o.map(
|
|
2375
|
+
folders: o.map(yi),
|
|
2376
2376
|
failures: a,
|
|
2377
2377
|
successCount: o.length,
|
|
2378
2378
|
failureCount: a.length
|
|
@@ -2380,28 +2380,28 @@ var oa = new class {
|
|
|
2380
2380
|
};
|
|
2381
2381
|
}
|
|
2382
2382
|
};
|
|
2383
|
-
function
|
|
2383
|
+
function ha(e, t) {
|
|
2384
2384
|
let n = e.length, r = e.map((e) => `• ${e.name} (id=${e.id}, workspaceId=${e.workspaceId})`);
|
|
2385
|
-
return
|
|
2385
|
+
return Y(n > 0 ? `Added ${n} folder${n === 1 ? "" : "s"}:\n${r.join("\n")}` : "Added 0 folders", t);
|
|
2386
2386
|
}
|
|
2387
2387
|
// src/tools/add-labels.ts
|
|
2388
|
-
var
|
|
2388
|
+
var ga = p.object({
|
|
2389
2389
|
name: p.string().min(1).max(128).describe("The name of the label."),
|
|
2390
|
-
color:
|
|
2390
|
+
color: pi,
|
|
2391
2391
|
order: p.number().int().optional().describe("The position of the label in the label list."),
|
|
2392
2392
|
isFavorite: p.boolean().optional().describe("Whether the label is a favorite. Defaults to false.")
|
|
2393
|
-
}),
|
|
2394
|
-
labels: p.array(
|
|
2393
|
+
}), _a = { labels: p.array(ga).min(1).max(O.ITEMS_PER_OPERATION).describe("The array of labels to add.") }, va = {
|
|
2394
|
+
labels: p.array(wi).describe("The created labels."),
|
|
2395
2395
|
totalCount: p.number().describe("The total number of labels created."),
|
|
2396
|
-
failures: p.array(
|
|
2396
|
+
failures: p.array(J).describe("Labels that could not be created, with the reason for each."),
|
|
2397
2397
|
totalRequested: p.number(),
|
|
2398
2398
|
successCount: p.number(),
|
|
2399
2399
|
failureCount: p.number()
|
|
2400
|
-
},
|
|
2400
|
+
}, ya = {
|
|
2401
2401
|
name: B.ADD_LABELS,
|
|
2402
2402
|
description: "Add one or more new personal labels.",
|
|
2403
|
-
parameters:
|
|
2404
|
-
outputSchema:
|
|
2403
|
+
parameters: _a,
|
|
2404
|
+
outputSchema: va,
|
|
2405
2405
|
annotations: {
|
|
2406
2406
|
readOnlyHint: !1,
|
|
2407
2407
|
destructiveHint: !1,
|
|
@@ -2413,12 +2413,12 @@ var ha = p.object({
|
|
|
2413
2413
|
findWith: B.FIND_LABELS
|
|
2414
2414
|
}))), (e) => e.name), i = n.map(({ value: e }) => e);
|
|
2415
2415
|
return L(B.ADD_LABELS, e.length, r, { redactItems: !0 }), {
|
|
2416
|
-
textContent:
|
|
2416
|
+
textContent: ba({
|
|
2417
2417
|
labels: i,
|
|
2418
2418
|
failures: r
|
|
2419
2419
|
}),
|
|
2420
2420
|
structuredContent: {
|
|
2421
|
-
labels: i.map((e) =>
|
|
2421
|
+
labels: i.map((e) => wi.parse(e)),
|
|
2422
2422
|
totalCount: i.length,
|
|
2423
2423
|
failures: r,
|
|
2424
2424
|
totalRequested: e.length,
|
|
@@ -2428,12 +2428,12 @@ var ha = p.object({
|
|
|
2428
2428
|
};
|
|
2429
2429
|
}
|
|
2430
2430
|
};
|
|
2431
|
-
function
|
|
2431
|
+
function ba({ labels: e, failures: t }) {
|
|
2432
2432
|
let n = e.length, r = e.map((e) => `• ${e.name} (id=${e.id})`).join("\n");
|
|
2433
|
-
return
|
|
2433
|
+
return Y(n > 0 ? `Added ${n} label${n === 1 ? "" : "s"}:\n${r}` : "Added 0 labels", t);
|
|
2434
2434
|
}
|
|
2435
2435
|
// src/utils/personal-project-limit.ts
|
|
2436
|
-
async function
|
|
2436
|
+
async function xa(e, t) {
|
|
2437
2437
|
try {
|
|
2438
2438
|
let { maxProjects: t, activeCount: n } = await R(() => e.getPersonalProjectCapacity());
|
|
2439
2439
|
return {
|
|
@@ -2445,16 +2445,16 @@ async function ba(e, t) {
|
|
|
2445
2445
|
return;
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
|
-
function
|
|
2448
|
+
function Sa(e, t) {
|
|
2449
2449
|
if (!e) throw Error(`Could not verify your personal project limit. ${t} Retry later.`);
|
|
2450
2450
|
if (e.activeCount >= e.maxProjects) throw Error(`Your account has reached its limit of ${e.maxProjects} active personal projects. ${t} Archive or delete a personal project, or upgrade to a plan with a higher limit, then retry.`);
|
|
2451
2451
|
}
|
|
2452
2452
|
// src/utils/template-ids.ts
|
|
2453
|
-
function
|
|
2453
|
+
function Ca(e) {
|
|
2454
2454
|
return e.replace(/[a-z]/gi, (e) => `[${e.toUpperCase()}${e.toLowerCase()}]`).replace(/\./g, "\\.");
|
|
2455
2455
|
}
|
|
2456
|
-
var
|
|
2457
|
-
function
|
|
2456
|
+
var wa = new RegExp(String.raw`^\s*(?:[A-Za-z0-9_\-]+|${Ca("https")}:\/\/(?:[A-Za-z0-9\-]+\.)*${Ca("todoist.com")}(?:\/\S*)?)\s*$`), Ta = "Pass a template slug (\"product-launch\"), a template ID (\"UT_...\"), or an https URL on todoist.com or one of its subdomains.";
|
|
2457
|
+
function Ea(e) {
|
|
2458
2458
|
let t = e.trim();
|
|
2459
2459
|
if (!/^https?:\/\//i.test(t)) return t;
|
|
2460
2460
|
let n;
|
|
@@ -2463,61 +2463,61 @@ function Ta(e) {
|
|
|
2463
2463
|
} catch {
|
|
2464
2464
|
throw Error(`Could not read a template ID from "${t}".`);
|
|
2465
2465
|
}
|
|
2466
|
-
if (!
|
|
2466
|
+
if (!Da(n.hostname)) throw Error(`"${n.hostname}" is not a Todoist domain. Pass a todoist.com template URL or the template ID itself.`);
|
|
2467
2467
|
n.hostname = "todoist.com";
|
|
2468
2468
|
let r = fe(n.toString());
|
|
2469
2469
|
if (r?.type !== "template") throw Error(`"${t}" is not a Todoist template URL.`);
|
|
2470
2470
|
return r.id;
|
|
2471
2471
|
}
|
|
2472
|
-
function
|
|
2472
|
+
function Da(e) {
|
|
2473
2473
|
let t = e.toLowerCase();
|
|
2474
2474
|
return t === "todoist.com" || t.endsWith(".todoist.com");
|
|
2475
2475
|
}
|
|
2476
2476
|
// src/tools/add-projects.ts
|
|
2477
|
-
var { FIND_FOLDERS:
|
|
2477
|
+
var { FIND_FOLDERS: Oa, FIND_PROJECTS: ka } = B, Aa = {
|
|
2478
2478
|
noun: "project",
|
|
2479
|
-
findWith:
|
|
2480
|
-
},
|
|
2479
|
+
findWith: ka
|
|
2480
|
+
}, ja = p.object({
|
|
2481
2481
|
name: p.string().min(1).optional().describe("The name of the project. Required, except with templateId, where it defaults to the template's name."),
|
|
2482
|
-
templateId: p.string().regex(
|
|
2482
|
+
templateId: p.string().regex(wa).optional().describe("Create the project from a template, with its sections, tasks and comments: a gallery slug (\"product-launch\"), a saved template ID (\"UT_28Ex...\"), or a Todoist template URL. With a template, only name, workspace, folderId and locale apply. To add a template to an existing project, use import-into-project."),
|
|
2483
2483
|
parentId: p.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
2484
2484
|
isFavorite: p.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
2485
2485
|
viewStyle: p.enum(x).optional().describe("The project view style. Defaults to \"list\"."),
|
|
2486
2486
|
description: p.string().optional().describe("The description of the project. Supports Markdown."),
|
|
2487
|
-
color:
|
|
2487
|
+
color: pi,
|
|
2488
2488
|
icon: p.enum(b).optional().describe("The project icon. Omit for the default # icon."),
|
|
2489
2489
|
workspace: p.string().trim().min(1).optional().describe("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."),
|
|
2490
|
-
folderId: p.string().min(1).optional().describe(`Create it in this workspace folder (see ${
|
|
2490
|
+
folderId: p.string().min(1).optional().describe(`Create it in this workspace folder (see ${Oa}). The folder sets the workspace, so workspace can be omitted.`),
|
|
2491
2491
|
locale: p.string().optional().describe("With templateId: the language of gallery template content, e.g. \"de\". Defaults to \"en\".")
|
|
2492
|
-
}),
|
|
2492
|
+
}), Ma = [
|
|
2493
2493
|
"parentId",
|
|
2494
2494
|
"isFavorite",
|
|
2495
2495
|
"viewStyle",
|
|
2496
2496
|
"description",
|
|
2497
2497
|
"color",
|
|
2498
2498
|
"icon"
|
|
2499
|
-
],
|
|
2500
|
-
projects: p.array(
|
|
2499
|
+
], Na = { projects: p.array(ja).min(1).max(O.ITEMS_PER_OPERATION).describe("The array of projects to add.") }, Pa = {
|
|
2500
|
+
projects: p.array(hi).describe("The created projects."),
|
|
2501
2501
|
totalCount: p.number().describe("The total number of projects created."),
|
|
2502
|
-
failures: p.array(
|
|
2502
|
+
failures: p.array(J).describe("Projects that could not be created, with the reason for each."),
|
|
2503
2503
|
totalRequested: p.number(),
|
|
2504
2504
|
successCount: p.number(),
|
|
2505
2505
|
failureCount: p.number()
|
|
2506
|
-
},
|
|
2506
|
+
}, Fa = {
|
|
2507
2507
|
name: B.ADD_PROJECTS,
|
|
2508
2508
|
description: "Add one or more new projects, empty or from a template.",
|
|
2509
|
-
parameters:
|
|
2510
|
-
outputSchema:
|
|
2509
|
+
parameters: Na,
|
|
2510
|
+
outputSchema: Pa,
|
|
2511
2511
|
annotations: {
|
|
2512
2512
|
readOnlyHint: !1,
|
|
2513
2513
|
destructiveHint: !1,
|
|
2514
2514
|
idempotentHint: !1
|
|
2515
2515
|
},
|
|
2516
2516
|
async execute({ projects: e }, t) {
|
|
2517
|
-
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i =
|
|
2517
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = Ua(() => xa(t, B.ADD_PROJECTS)), a = (e) => {
|
|
2518
2518
|
if (!e) return Promise.resolve(void 0);
|
|
2519
2519
|
let r = n.get(e);
|
|
2520
|
-
return r || (r = R(() =>
|
|
2520
|
+
return r || (r = R(() => sa.resolveWorkspace(t, e)).then(({ workspaceId: e }) => e), n.set(e, r)), r;
|
|
2521
2521
|
}, o = (e) => {
|
|
2522
2522
|
let n = r.get(e);
|
|
2523
2523
|
return n || (n = R(() => t.getFolder(e)), r.set(e, n)), n;
|
|
@@ -2526,11 +2526,11 @@ var { FIND_FOLDERS: Da, FIND_PROJECTS: Oa } = B, ka = {
|
|
|
2526
2526
|
if (n.templateId) {
|
|
2527
2527
|
c.push({
|
|
2528
2528
|
index: t,
|
|
2529
|
-
project:
|
|
2529
|
+
project: Ia(n)
|
|
2530
2530
|
});
|
|
2531
2531
|
continue;
|
|
2532
2532
|
}
|
|
2533
|
-
let { folderId: e, ...r } =
|
|
2533
|
+
let { folderId: e, ...r } = La(n);
|
|
2534
2534
|
e ? l.push({
|
|
2535
2535
|
index: t,
|
|
2536
2536
|
project: r,
|
|
@@ -2550,14 +2550,14 @@ var { FIND_FOLDERS: Da, FIND_PROJECTS: Oa } = B, ka = {
|
|
|
2550
2550
|
}
|
|
2551
2551
|
let { succeeded: d, failures: f } = I(e, (await Promise.all([
|
|
2552
2552
|
s,
|
|
2553
|
-
|
|
2553
|
+
Va(t, l, {
|
|
2554
2554
|
lookupFolder: o,
|
|
2555
2555
|
resolveWorkspaceId: a
|
|
2556
2556
|
}),
|
|
2557
2557
|
...c.map(async ({ project: e, index: n }) => [{
|
|
2558
2558
|
index: n,
|
|
2559
|
-
outcome: await
|
|
2560
|
-
let { workspace: n, templateId: r, folderId: s, locale: c, name: l } = e, u = s ? (await
|
|
2559
|
+
outcome: await Ba(async () => {
|
|
2560
|
+
let { workspace: n, templateId: r, folderId: s, locale: c, name: l } = e, u = s ? (await Ra(await o(s), n, a)).workspaceId : await a(n), d = () => za(t, {
|
|
2561
2561
|
templateId: r,
|
|
2562
2562
|
name: l,
|
|
2563
2563
|
locale: c,
|
|
@@ -2569,17 +2569,17 @@ var { FIND_FOLDERS: Da, FIND_PROJECTS: Oa } = B, ka = {
|
|
|
2569
2569
|
}]),
|
|
2570
2570
|
...u.map(async ({ project: { workspace: e, ...n }, index: r }) => [{
|
|
2571
2571
|
index: r,
|
|
2572
|
-
outcome: await
|
|
2572
|
+
outcome: await Ba(async () => {
|
|
2573
2573
|
let r = await a(e), o = () => z(() => t.addProject({
|
|
2574
2574
|
...n,
|
|
2575
2575
|
...r ? { workspaceId: r } : {}
|
|
2576
|
-
}),
|
|
2576
|
+
}), Aa);
|
|
2577
2577
|
return e ? await o() : await i(o);
|
|
2578
2578
|
})
|
|
2579
2579
|
}])
|
|
2580
|
-
])).flat().sort((e, t) => e.index - t.index).map(({ outcome: e }) => e), (e, t) => e.name ?? e.templateId ?? `Project ${t + 1}`), p = d.map(({ value: e }) => e), m = p.map(
|
|
2580
|
+
])).flat().sort((e, t) => e.index - t.index).map(({ outcome: e }) => e), (e, t) => e.name ?? e.templateId ?? `Project ${t + 1}`), p = d.map(({ value: e }) => e), m = p.map(Yr);
|
|
2581
2581
|
return L(B.ADD_PROJECTS, e.length, f, { redactItems: !0 }), {
|
|
2582
|
-
textContent:
|
|
2582
|
+
textContent: Wa({
|
|
2583
2583
|
projects: p,
|
|
2584
2584
|
failures: f
|
|
2585
2585
|
}),
|
|
@@ -2594,20 +2594,20 @@ var { FIND_FOLDERS: Da, FIND_PROJECTS: Oa } = B, ka = {
|
|
|
2594
2594
|
};
|
|
2595
2595
|
}
|
|
2596
2596
|
};
|
|
2597
|
-
function
|
|
2598
|
-
let t =
|
|
2597
|
+
function Ia(e) {
|
|
2598
|
+
let t = Ma.filter((t) => e[t] !== void 0);
|
|
2599
2599
|
if (t.length > 0) throw Error(`A project created from a template takes only name, workspace, folderId and locale, not ${t.join(", ")}. Create it from the template first, then change those with update-projects, or move it under a parent with project-move.`);
|
|
2600
2600
|
let { templateId: n, name: r, workspace: i, folderId: a, locale: o } = e;
|
|
2601
2601
|
if (!n) throw Error("A project from a template needs its templateId.");
|
|
2602
2602
|
return {
|
|
2603
|
-
templateId:
|
|
2603
|
+
templateId: Ea(n),
|
|
2604
2604
|
name: r,
|
|
2605
2605
|
workspace: i,
|
|
2606
2606
|
folderId: a,
|
|
2607
2607
|
locale: o
|
|
2608
2608
|
};
|
|
2609
2609
|
}
|
|
2610
|
-
function
|
|
2610
|
+
function La(e) {
|
|
2611
2611
|
let { name: t, locale: n, templateId: r, ...i } = e;
|
|
2612
2612
|
if (n !== void 0) throw Error("locale only applies with templateId.");
|
|
2613
2613
|
if (t === void 0) throw Error("A project needs a name, unless it is created from a template.");
|
|
@@ -2616,19 +2616,19 @@ function Ia(e) {
|
|
|
2616
2616
|
name: t
|
|
2617
2617
|
};
|
|
2618
2618
|
}
|
|
2619
|
-
async function
|
|
2619
|
+
async function Ra(e, t, n) {
|
|
2620
2620
|
if (t && await n(t) !== e.workspaceId) throw Error(`Folder "${e.name}" (id=${e.id}) is in workspace id=${e.workspaceId}, not "${t}". Omit workspace to create the project in the folder's workspace.`);
|
|
2621
2621
|
return e;
|
|
2622
2622
|
}
|
|
2623
|
-
async function
|
|
2624
|
-
let { projectId: n } = await z(() => e.addProjectFromTemplateId(t),
|
|
2623
|
+
async function za(e, t) {
|
|
2624
|
+
let { projectId: n } = await z(() => e.addProjectFromTemplateId(t), Aa);
|
|
2625
2625
|
try {
|
|
2626
2626
|
return await R(() => e.getProject(n));
|
|
2627
2627
|
} catch (e) {
|
|
2628
2628
|
throw console.error(`${B.ADD_PROJECTS}: could not read back project ${n}`, e), Error(`Created project id=${n} from the template, but could not read it back. Do not retry: the project exists.`);
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
|
-
async function
|
|
2631
|
+
async function Ba(e) {
|
|
2632
2632
|
try {
|
|
2633
2633
|
return {
|
|
2634
2634
|
status: "fulfilled",
|
|
@@ -2641,12 +2641,12 @@ async function za(e) {
|
|
|
2641
2641
|
};
|
|
2642
2642
|
}
|
|
2643
2643
|
}
|
|
2644
|
-
async function
|
|
2644
|
+
async function Va(e, t, { lookupFolder: n, resolveWorkspaceId: r }) {
|
|
2645
2645
|
let a = await Promise.all(t.map(async ({ index: e, project: { workspace: t, ...a }, folderId: o }) => ({
|
|
2646
2646
|
index: e,
|
|
2647
2647
|
project: a,
|
|
2648
2648
|
tempId: i(),
|
|
2649
|
-
folder: await
|
|
2649
|
+
folder: await Ba(async () => Ra(await n(o), t, r))
|
|
2650
2650
|
}))), o = [], s = [];
|
|
2651
2651
|
for (let { index: e, project: t, tempId: n, folder: r } of a) {
|
|
2652
2652
|
if (r.status === "rejected") {
|
|
@@ -2668,13 +2668,13 @@ async function Ba(e, t, { lookupFolder: n, resolveWorkspaceId: r }) {
|
|
|
2668
2668
|
});
|
|
2669
2669
|
}
|
|
2670
2670
|
if (s.length === 0) return o;
|
|
2671
|
-
let { outcomes: c, tempIdMapping: l } = await
|
|
2671
|
+
let { outcomes: c, tempIdMapping: l } = await Q(e, s.map(({ command: e }) => e), { created: Aa }), u = await Promise.all(s.map(async ({ index: t, tempId: n }, r) => ({
|
|
2672
2672
|
index: t,
|
|
2673
|
-
outcome: await
|
|
2673
|
+
outcome: await Ba(() => Ha(e, c[r], l[n]))
|
|
2674
2674
|
})));
|
|
2675
2675
|
return [...o, ...u];
|
|
2676
2676
|
}
|
|
2677
|
-
async function
|
|
2677
|
+
async function Ha(e, t, n) {
|
|
2678
2678
|
if (t?.status === "rejected") throw t.reason;
|
|
2679
2679
|
if (!n) throw Error("Todoist reported the project as created but did not return its ID. Check the folder before creating it again.");
|
|
2680
2680
|
try {
|
|
@@ -2683,13 +2683,13 @@ async function Va(e, t, n) {
|
|
|
2683
2683
|
throw Error(`Created in the folder as id=${n}, but reading it back failed. Do not create it again.`);
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
|
-
function
|
|
2686
|
+
function Ua(e) {
|
|
2687
2687
|
let t, n = 0, r = [];
|
|
2688
2688
|
return async function(i) {
|
|
2689
2689
|
t ??= e();
|
|
2690
2690
|
let a = await t;
|
|
2691
2691
|
for (; a && n > 0 && a.activeCount + n >= a.maxProjects;) await new Promise((e) => r.push(e));
|
|
2692
|
-
|
|
2692
|
+
Sa(a, "This project was not created."), n++;
|
|
2693
2693
|
try {
|
|
2694
2694
|
let e = await i();
|
|
2695
2695
|
return a.activeCount++, e;
|
|
@@ -2703,16 +2703,16 @@ function Ha(e) {
|
|
|
2703
2703
|
}
|
|
2704
2704
|
};
|
|
2705
2705
|
}
|
|
2706
|
-
function
|
|
2706
|
+
function Wa({ projects: e, failures: t }) {
|
|
2707
2707
|
let n = e.length, r = e.map((e) => `• ${e.name} (id=${e.id})`).join("\n");
|
|
2708
|
-
return
|
|
2708
|
+
return Y(n > 0 ? `Added ${n} project${n === 1 ? "" : "s"}:\n${r}` : "Added 0 projects", t);
|
|
2709
2709
|
}
|
|
2710
2710
|
// src/utils/reminder-recipients.ts
|
|
2711
|
-
async function
|
|
2711
|
+
async function Ga(e, t) {
|
|
2712
2712
|
let n = /* @__PURE__ */ new Map();
|
|
2713
2713
|
for (let e of t) {
|
|
2714
2714
|
let t = e?.trim();
|
|
2715
|
-
t && !n.has(
|
|
2715
|
+
t && !n.has(Ka(t)) && n.set(Ka(t), t);
|
|
2716
2716
|
}
|
|
2717
2717
|
let r = /* @__PURE__ */ new Map();
|
|
2718
2718
|
for (let [t, i] of n) try {
|
|
@@ -2731,66 +2731,66 @@ async function Wa(e, t) {
|
|
|
2731
2731
|
status: "fulfilled",
|
|
2732
2732
|
value: void 0
|
|
2733
2733
|
};
|
|
2734
|
-
return t.map((e) => e?.trim() ? r.get(
|
|
2734
|
+
return t.map((e) => e?.trim() ? r.get(Ka(e)) ?? i : i);
|
|
2735
2735
|
}
|
|
2736
|
-
function
|
|
2736
|
+
function Ka(e) {
|
|
2737
2737
|
return e.trim().toLowerCase();
|
|
2738
2738
|
}
|
|
2739
|
-
function
|
|
2739
|
+
function qa(e, t) {
|
|
2740
2740
|
return e.flatMap((e, n) => {
|
|
2741
2741
|
let r = t[n];
|
|
2742
2742
|
return !r || e.notifyUid === r ? [] : [`Warning: reminder ${e.id} notifies user ${e.notifyUid ?? "unknown"}, not the requested user ${r}. Todoist did not apply notifyUser.`];
|
|
2743
2743
|
});
|
|
2744
2744
|
}
|
|
2745
2745
|
// src/utils/reminder-schemas.ts
|
|
2746
|
-
var
|
|
2746
|
+
var Ja = p.enum(S), Ya = p.object({
|
|
2747
2747
|
date: p.string().optional().describe("Due date in YYYY-MM-DD format."),
|
|
2748
2748
|
string: p.string().optional().describe("Natural language due string, e.g. \"tomorrow at 3pm\"."),
|
|
2749
2749
|
timezone: p.string().optional().describe("Timezone for the reminder, e.g. \"America/New_York\"."),
|
|
2750
2750
|
lang: p.string().optional().describe("Language for parsing the due string, e.g. \"en\".")
|
|
2751
|
-
}),
|
|
2751
|
+
}), Xa = p.enum(y), Za = p.boolean().optional().describe("Whether this is an urgent reminder. Applies to relative and absolute reminders."), Qa = "Who to remind: user ID, email, name, or \"me\". Must collaborate on the task's project.", $a = Z(`${Qa} Defaults to the creator.`), eo = Z(`${Qa} Omit to keep the current one.`), to = {
|
|
2752
2752
|
noun: "reminder",
|
|
2753
2753
|
findWith: B.FIND_REMINDERS
|
|
2754
|
-
},
|
|
2754
|
+
}, no = p.object({
|
|
2755
2755
|
type: p.literal("relative"),
|
|
2756
2756
|
taskId: p.string().min(1).describe("The ID of the task to set a reminder for."),
|
|
2757
2757
|
minuteOffset: p.number().int().min(0).describe("Minutes before the task due time to trigger the reminder. E.g., 30 for 30 minutes before, 60 for 1 hour before, 1440 for 1 day before."),
|
|
2758
|
-
service:
|
|
2759
|
-
isUrgent:
|
|
2760
|
-
notifyUser:
|
|
2761
|
-
}),
|
|
2758
|
+
service: Ja.optional().describe("Delivery method: \"email\" or \"push\" notification. Defaults to push."),
|
|
2759
|
+
isUrgent: Za,
|
|
2760
|
+
notifyUser: $a
|
|
2761
|
+
}), ro = p.object({
|
|
2762
2762
|
type: p.literal("absolute"),
|
|
2763
2763
|
taskId: p.string().min(1).describe("The ID of the task to set a reminder for."),
|
|
2764
|
-
due:
|
|
2765
|
-
service:
|
|
2766
|
-
isUrgent:
|
|
2767
|
-
notifyUser:
|
|
2768
|
-
}),
|
|
2764
|
+
due: Ya.describe("The specific date/time for the reminder."),
|
|
2765
|
+
service: Ja.optional().describe("Delivery method: \"email\" or \"push\" notification. Defaults to push."),
|
|
2766
|
+
isUrgent: Za,
|
|
2767
|
+
notifyUser: $a
|
|
2768
|
+
}), io = p.object({
|
|
2769
2769
|
type: p.literal("location"),
|
|
2770
2770
|
taskId: p.string().min(1).describe("The ID of the task to set a reminder for."),
|
|
2771
2771
|
name: p.string().min(1).describe("Name of the location, e.g. \"Office\", \"Home\"."),
|
|
2772
2772
|
locLat: p.string().describe("Latitude of the location as a string, e.g. \"37.7749\"."),
|
|
2773
2773
|
locLong: p.string().describe("Longitude of the location as a string, e.g. \"-122.4194\"."),
|
|
2774
|
-
locTrigger:
|
|
2774
|
+
locTrigger: Xa.describe("When to trigger: \"on_enter\" (arriving) or \"on_leave\" (departing)."),
|
|
2775
2775
|
radius: p.number().int().optional().describe("Radius in meters for the geofence. Defaults to server default."),
|
|
2776
|
-
notifyUser:
|
|
2777
|
-
}),
|
|
2778
|
-
to,
|
|
2776
|
+
notifyUser: $a
|
|
2777
|
+
}), ao = p.discriminatedUnion("type", [
|
|
2779
2778
|
no,
|
|
2780
|
-
ro
|
|
2781
|
-
|
|
2782
|
-
|
|
2779
|
+
ro,
|
|
2780
|
+
io
|
|
2781
|
+
]), oo = { reminders: p.array(ao).min(1).max(25).describe("Array of reminders to create (max 25). Each reminder must specify a type: \"relative\" (minutes before due), \"absolute\" (specific date/time), or \"location\" (geofence trigger).") }, so = {
|
|
2782
|
+
reminders: p.array(Ei).describe("The created reminders."),
|
|
2783
2783
|
totalCount: p.number().describe("Total number of reminders created."),
|
|
2784
2784
|
addedReminderIds: p.array(p.string()).describe("IDs of the created reminders."),
|
|
2785
|
-
failures: p.array(
|
|
2785
|
+
failures: p.array(J).describe("Reminders that could not be created, with the reason for each."),
|
|
2786
2786
|
totalRequested: p.number(),
|
|
2787
2787
|
successCount: p.number(),
|
|
2788
2788
|
failureCount: p.number()
|
|
2789
|
-
},
|
|
2789
|
+
}, co = {
|
|
2790
2790
|
name: B.ADD_REMINDERS,
|
|
2791
2791
|
description: "Add reminders to tasks. Supports three types: \"relative\" (minutes before due), \"absolute\" (specific date/time), or \"location\" (geofence-triggered). Each reminder must specify a taskId. Reminders notify their creator unless notifyUser says otherwise.",
|
|
2792
|
-
parameters:
|
|
2793
|
-
outputSchema:
|
|
2792
|
+
parameters: oo,
|
|
2793
|
+
outputSchema: so,
|
|
2794
2794
|
annotations: {
|
|
2795
2795
|
readOnlyHint: !1,
|
|
2796
2796
|
destructiveHint: !1,
|
|
@@ -2798,7 +2798,7 @@ var qa = p.enum(S), Ja = p.object({
|
|
|
2798
2798
|
openWorldHint: !0
|
|
2799
2799
|
},
|
|
2800
2800
|
async execute(e, t) {
|
|
2801
|
-
let { reminders: n } = e, r = await
|
|
2801
|
+
let { reminders: n } = e, r = await Ga(t, n.map((e) => e.notifyUser)), { succeeded: i, failures: a } = I(n, await Promise.allSettled(n.map(async (e, n) => {
|
|
2802
2802
|
let i = r[n];
|
|
2803
2803
|
if (i?.status === "rejected") throw i.reason;
|
|
2804
2804
|
let a = i?.value;
|
|
@@ -2810,7 +2810,7 @@ var qa = p.enum(S), Ja = p.object({
|
|
|
2810
2810
|
service: e.service,
|
|
2811
2811
|
isUrgent: e.isUrgent,
|
|
2812
2812
|
notifyUid: a
|
|
2813
|
-
}),
|
|
2813
|
+
}), to);
|
|
2814
2814
|
case "absolute": return await z(() => t.addReminder({
|
|
2815
2815
|
taskId: e.taskId,
|
|
2816
2816
|
reminderType: "absolute",
|
|
@@ -2818,7 +2818,7 @@ var qa = p.enum(S), Ja = p.object({
|
|
|
2818
2818
|
service: e.service,
|
|
2819
2819
|
isUrgent: e.isUrgent,
|
|
2820
2820
|
notifyUid: a
|
|
2821
|
-
}),
|
|
2821
|
+
}), to);
|
|
2822
2822
|
case "location": return await z(() => t.addLocationReminder({
|
|
2823
2823
|
taskId: e.taskId,
|
|
2824
2824
|
name: e.name,
|
|
@@ -2827,14 +2827,14 @@ var qa = p.enum(S), Ja = p.object({
|
|
|
2827
2827
|
locTrigger: e.locTrigger,
|
|
2828
2828
|
radius: e.radius,
|
|
2829
2829
|
notifyUid: a
|
|
2830
|
-
}),
|
|
2830
|
+
}), to);
|
|
2831
2831
|
}
|
|
2832
|
-
})), (e, t) => `Reminder ${t + 1} on task ${e.taskId}`), o = i.map(({ value: e }) =>
|
|
2832
|
+
})), (e, t) => `Reminder ${t + 1} on task ${e.taskId}`), o = i.map(({ value: e }) => ni(e)), s = i.map(({ index: e }) => {
|
|
2833
2833
|
let t = r[e];
|
|
2834
2834
|
return t?.status === "fulfilled" ? t.value : void 0;
|
|
2835
2835
|
});
|
|
2836
2836
|
return L(B.ADD_REMINDERS, n.length, a), {
|
|
2837
|
-
textContent:
|
|
2837
|
+
textContent: Y([lo(o), ...qa(o, s)].join("\n"), a),
|
|
2838
2838
|
structuredContent: {
|
|
2839
2839
|
reminders: o,
|
|
2840
2840
|
totalCount: o.length,
|
|
@@ -2847,8 +2847,8 @@ var qa = p.enum(S), Ja = p.object({
|
|
|
2847
2847
|
};
|
|
2848
2848
|
}
|
|
2849
2849
|
};
|
|
2850
|
-
function
|
|
2851
|
-
let { timeBasedCount: t, locationCount: n } =
|
|
2850
|
+
function lo(e) {
|
|
2851
|
+
let { timeBasedCount: t, locationCount: n } = ri(e), r = [];
|
|
2852
2852
|
if (t > 0) {
|
|
2853
2853
|
let e = t > 1 ? "reminders" : "reminder";
|
|
2854
2854
|
r.push(`${t} time-based ${e}`);
|
|
@@ -2860,30 +2860,30 @@ function co(e) {
|
|
|
2860
2860
|
return r.length > 0 ? `Added ${r.join(" and ")}` : "No reminders added";
|
|
2861
2861
|
}
|
|
2862
2862
|
// src/tools/add-sections.ts
|
|
2863
|
-
var
|
|
2863
|
+
var uo = p.object({
|
|
2864
2864
|
name: p.string().min(1).describe("The name of the section."),
|
|
2865
2865
|
projectId: p.string().min(1).describe("The ID of the project to add the section to. Project ID should be an ID string, or the text \"inbox\", for inbox tasks."),
|
|
2866
2866
|
description: p.string().optional().describe("The description of the section. Supports Markdown.")
|
|
2867
|
-
}),
|
|
2868
|
-
sections: p.array(
|
|
2867
|
+
}), fo = { sections: p.array(uo).min(1).max(O.ITEMS_PER_OPERATION).describe("The array of sections to add.") }, po = {
|
|
2868
|
+
sections: p.array(gi).describe("The created sections."),
|
|
2869
2869
|
totalCount: p.number().describe("The total number of sections created."),
|
|
2870
|
-
failures: p.array(
|
|
2870
|
+
failures: p.array(J).describe("Sections that could not be created, with the reason for each."),
|
|
2871
2871
|
totalRequested: p.number(),
|
|
2872
2872
|
successCount: p.number(),
|
|
2873
2873
|
failureCount: p.number()
|
|
2874
|
-
},
|
|
2874
|
+
}, mo = {
|
|
2875
2875
|
name: B.ADD_SECTIONS,
|
|
2876
2876
|
description: "Add one or more new sections to projects.",
|
|
2877
|
-
parameters:
|
|
2878
|
-
outputSchema:
|
|
2877
|
+
parameters: fo,
|
|
2878
|
+
outputSchema: po,
|
|
2879
2879
|
annotations: {
|
|
2880
2880
|
readOnlyHint: !1,
|
|
2881
2881
|
destructiveHint: !1,
|
|
2882
2882
|
idempotentHint: !1
|
|
2883
2883
|
},
|
|
2884
2884
|
async execute({ sections: e }, t) {
|
|
2885
|
-
let n = e.some((e) =>
|
|
2886
|
-
let r =
|
|
2885
|
+
let n = e.some((e) => Pr(e.projectId)) ? R(() => t.getUser()) : void 0, { succeeded: r, failures: i } = I(e, await Promise.allSettled(e.map(async (e) => {
|
|
2886
|
+
let r = Pr(e.projectId) ? await n : void 0, i = await Fr({
|
|
2887
2887
|
projectId: e.projectId,
|
|
2888
2888
|
user: r,
|
|
2889
2889
|
client: void 0
|
|
@@ -2897,12 +2897,12 @@ var lo = p.object({
|
|
|
2897
2897
|
});
|
|
2898
2898
|
})), (e) => e.name), a = r.map(({ value: e }) => e);
|
|
2899
2899
|
return L(B.ADD_SECTIONS, e.length, i, { redactItems: !0 }), {
|
|
2900
|
-
textContent:
|
|
2900
|
+
textContent: ho({
|
|
2901
2901
|
sections: a,
|
|
2902
2902
|
failures: i
|
|
2903
2903
|
}),
|
|
2904
2904
|
structuredContent: {
|
|
2905
|
-
sections: a.map(
|
|
2905
|
+
sections: a.map(_i),
|
|
2906
2906
|
totalCount: a.length,
|
|
2907
2907
|
failures: i,
|
|
2908
2908
|
totalRequested: e.length,
|
|
@@ -2912,12 +2912,12 @@ var lo = p.object({
|
|
|
2912
2912
|
};
|
|
2913
2913
|
}
|
|
2914
2914
|
};
|
|
2915
|
-
function
|
|
2915
|
+
function ho({ sections: e, failures: t }) {
|
|
2916
2916
|
let n = e.length, r = e.map((e) => `• ${e.name} (id=${e.id}, projectId=${e.projectId})`).join("\n");
|
|
2917
|
-
return
|
|
2917
|
+
return Y(n > 0 ? `Added ${n} section${n === 1 ? "" : "s"}:\n${r}` : "Added 0 sections", t);
|
|
2918
2918
|
}
|
|
2919
2919
|
// src/utils/assignment-validator.ts
|
|
2920
|
-
var
|
|
2920
|
+
var $ = {
|
|
2921
2921
|
USER_NOT_FOUND: "USER_NOT_FOUND",
|
|
2922
2922
|
USER_AMBIGUOUS: "USER_AMBIGUOUS",
|
|
2923
2923
|
USER_NOT_COLLABORATOR: "USER_NOT_COLLABORATOR",
|
|
@@ -2938,7 +2938,7 @@ var ho = {
|
|
|
2938
2938
|
taskId: r,
|
|
2939
2939
|
projectId: i,
|
|
2940
2940
|
error: {
|
|
2941
|
-
type:
|
|
2941
|
+
type: $.USER_AMBIGUOUS,
|
|
2942
2942
|
message: e.message
|
|
2943
2943
|
}
|
|
2944
2944
|
};
|
|
@@ -2948,7 +2948,7 @@ var ho = {
|
|
|
2948
2948
|
taskId: r,
|
|
2949
2949
|
projectId: i,
|
|
2950
2950
|
error: {
|
|
2951
|
-
type:
|
|
2951
|
+
type: $.USER_NOT_FOUND,
|
|
2952
2952
|
message: `User "${a}" not found`,
|
|
2953
2953
|
suggestions: [
|
|
2954
2954
|
"Check the spelling of the user name or email",
|
|
@@ -2965,7 +2965,7 @@ var ho = {
|
|
|
2965
2965
|
projectId: i,
|
|
2966
2966
|
resolvedUser: o,
|
|
2967
2967
|
error: {
|
|
2968
|
-
type:
|
|
2968
|
+
type: $.PROJECT_NOT_SHARED,
|
|
2969
2969
|
message: `Project "${t.name}" is not shared. Task assignments require a shared project with collaborators. Share the project with at least one other person to enable assignments.`,
|
|
2970
2970
|
suggestions: ["Share the project with at least one collaborator to enable assignments", "Use find-project-collaborators to check project sharing status"]
|
|
2971
2971
|
}
|
|
@@ -2976,7 +2976,7 @@ var ho = {
|
|
|
2976
2976
|
projectId: i,
|
|
2977
2977
|
resolvedUser: o,
|
|
2978
2978
|
error: {
|
|
2979
|
-
type:
|
|
2979
|
+
type: $.USER_NOT_COLLABORATOR,
|
|
2980
2980
|
message: `User "${o.displayName}" is not a collaborator on project "${t.name}"`,
|
|
2981
2981
|
suggestions: [
|
|
2982
2982
|
"Invite the user to collaborate on this project first",
|
|
@@ -2994,7 +2994,7 @@ var ho = {
|
|
|
2994
2994
|
projectId: i,
|
|
2995
2995
|
resolvedUser: o,
|
|
2996
2996
|
error: {
|
|
2997
|
-
type:
|
|
2997
|
+
type: $.TASK_NOT_FOUND,
|
|
2998
2998
|
message: `Task "${r}" not found or not accessible`,
|
|
2999
2999
|
suggestions: [
|
|
3000
3000
|
"Verify the task ID is correct",
|
|
@@ -3017,7 +3017,7 @@ var ho = {
|
|
|
3017
3017
|
projectId: i,
|
|
3018
3018
|
resolvedUser: o,
|
|
3019
3019
|
error: {
|
|
3020
|
-
type:
|
|
3020
|
+
type: $.PERMISSION_DENIED,
|
|
3021
3021
|
message: "Permission denied or API error occurred",
|
|
3022
3022
|
suggestions: [
|
|
3023
3023
|
"Check your API permissions",
|
|
@@ -3055,7 +3055,7 @@ var ho = {
|
|
|
3055
3055
|
isValid: !1,
|
|
3056
3056
|
taskId: t,
|
|
3057
3057
|
error: {
|
|
3058
|
-
type:
|
|
3058
|
+
type: $.TASK_NOT_FOUND,
|
|
3059
3059
|
message: `Task "${t}" not found or not accessible`,
|
|
3060
3060
|
suggestions: [
|
|
3061
3061
|
"Verify the task ID is correct",
|
|
@@ -3130,22 +3130,22 @@ var ho = {
|
|
|
3130
3130
|
}
|
|
3131
3131
|
}(), _o = O.TASK_CREATES_PER_OPERATION, vo = p.object({
|
|
3132
3132
|
content: p.string().min(1).describe("The task name/title. Should be concise and actionable (e.g., \"Review PR #123\", \"Call dentist\"). For longer content, use the description field instead. Supports Markdown."),
|
|
3133
|
-
description:
|
|
3133
|
+
description: Z("Additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown."),
|
|
3134
3134
|
priority: sr.optional().describe(or),
|
|
3135
|
-
dueString:
|
|
3136
|
-
deadlineDate:
|
|
3137
|
-
duration:
|
|
3135
|
+
dueString: Z("The due date for the task, in natural language. Also use natural language for recurrences; do not prefix it with \"recurring\"."),
|
|
3136
|
+
deadlineDate: Z("The deadline date for the task in ISO 8601 format (YYYY-MM-DD, e.g., \"2025-12-31\"). Deadlines are immovable constraints shown with a different indicator than due dates."),
|
|
3137
|
+
duration: Z(Xn),
|
|
3138
3138
|
labels: p.array(p.string()).max(O.LABELS_PER_TASK).optional().describe("The labels to attach to the task."),
|
|
3139
|
-
projectId:
|
|
3140
|
-
sectionId:
|
|
3141
|
-
parentId:
|
|
3139
|
+
projectId: Z("The project ID to add this task to. Project ID should be an ID string, or the text \"inbox\", for inbox tasks."),
|
|
3140
|
+
sectionId: Z("The section ID to add this task to."),
|
|
3141
|
+
parentId: Z("The parent task ID (for subtasks)."),
|
|
3142
3142
|
order: p.number().optional().describe("Position of the task among sibling tasks under the same parent/section."),
|
|
3143
|
-
responsibleUser:
|
|
3143
|
+
responsibleUser: Z("Assign task to this user. Can be \"me\" (assigns to current user), a user ID, name, or email address. User must be a collaborator on the target project."),
|
|
3144
3144
|
isUncompletable: p.boolean().optional().describe("Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed.")
|
|
3145
3145
|
}), yo = { tasks: p.array(vo).min(1).max(_o).describe(`The array of tasks to add (max ${_o}).`) }, bo = {
|
|
3146
|
-
tasks: p.array(
|
|
3146
|
+
tasks: p.array(q).describe("The created tasks."),
|
|
3147
3147
|
totalCount: p.number().describe("The total number of tasks created."),
|
|
3148
|
-
failures: p.array(
|
|
3148
|
+
failures: p.array(J).describe("Tasks that could not be created, with the reason for each."),
|
|
3149
3149
|
totalRequested: p.number(),
|
|
3150
3150
|
successCount: p.number(),
|
|
3151
3151
|
failureCount: p.number()
|
|
@@ -3171,7 +3171,7 @@ var ho = {
|
|
|
3171
3171
|
})), { succeeded: o, failures: s } = I(n, i.map((e, t) => e.status === "rejected" ? e : a.get(t) ?? {
|
|
3172
3172
|
status: "rejected",
|
|
3173
3173
|
reason: /* @__PURE__ */ Error("Todoist did not report whether this task was created")
|
|
3174
|
-
}), (e) => e.content), c = o.map(({ value: e }) => e), l = c.map(
|
|
3174
|
+
}), (e) => e.content), c = o.map(({ value: e }) => e), l = c.map(G);
|
|
3175
3175
|
return L(B.ADD_TASKS, n.length, s, { redactItems: !0 }), {
|
|
3176
3176
|
textContent: ko({
|
|
3177
3177
|
tasks: l,
|
|
@@ -3195,7 +3195,7 @@ function So(e) {
|
|
|
3195
3195
|
let r = e.get(t);
|
|
3196
3196
|
return r || (r = n(), e.set(t, r)), r;
|
|
3197
3197
|
}
|
|
3198
|
-
let a =
|
|
3198
|
+
let a = Br(e);
|
|
3199
3199
|
return {
|
|
3200
3200
|
lookUpProject: a,
|
|
3201
3201
|
lookUpSectionProject: (n) => i(t, n, async () => (await R(() => e.getSection(n)))?.projectId),
|
|
@@ -3204,7 +3204,7 @@ function So(e) {
|
|
|
3204
3204
|
};
|
|
3205
3205
|
}
|
|
3206
3206
|
async function Co(e, t) {
|
|
3207
|
-
let { content: n, description: r, duration: a, projectId: o, sectionId: s, parentId: c, order: l, responsibleUser: u, priority: d, labels: f, dueString: p, deadlineDate: m, isUncompletable: h } = e, g =
|
|
3207
|
+
let { content: n, description: r, duration: a, projectId: o, sectionId: s, parentId: c, order: l, responsibleUser: u, priority: d, labels: f, dueString: p, deadlineDate: m, isUncompletable: h } = e, g = Pr(o) ? void 0 : o;
|
|
3208
3208
|
if (g) {
|
|
3209
3209
|
let e = await t.lookUpProject(g);
|
|
3210
3210
|
if (e.isArchived) throw Error(`Task "${n}": Cannot create task in archived project "${e.name}"`);
|
|
@@ -3246,14 +3246,14 @@ async function wo(e, t, n) {
|
|
|
3246
3246
|
let c = await t.checkAssignee(s, o);
|
|
3247
3247
|
if (!c.isValid) {
|
|
3248
3248
|
let e = c.error?.message || "Assignment validation failed", t = c.error?.suggestions?.join(". ") || "";
|
|
3249
|
-
throw new (c.error?.type ===
|
|
3249
|
+
throw new (c.error?.type === $.USER_AMBIGUOUS ? st : Error)(`Task "${r}": ${e}${t ? `. ${t}` : ""}`);
|
|
3250
3250
|
}
|
|
3251
3251
|
return c.resolvedUser?.userId;
|
|
3252
3252
|
}
|
|
3253
3253
|
async function To(e, t) {
|
|
3254
3254
|
let n = /* @__PURE__ */ new Map();
|
|
3255
3255
|
if (t.length === 0) return n;
|
|
3256
|
-
let { outcomes: r, tempIdMapping: i, requestFailed: a } = await
|
|
3256
|
+
let { outcomes: r, tempIdMapping: i, requestFailed: a } = await Q(e, t.map(({ command: e }) => e), { created: {
|
|
3257
3257
|
noun: "task",
|
|
3258
3258
|
findWith: B.FIND_TASKS
|
|
3259
3259
|
} }), o = /* @__PURE__ */ new Map();
|
|
@@ -3311,20 +3311,20 @@ function Oo(e) {
|
|
|
3311
3311
|
}
|
|
3312
3312
|
function ko({ tasks: e, failures: t, args: n }) {
|
|
3313
3313
|
let r = /* @__PURE__ */ new Set();
|
|
3314
|
-
for (let e of n.tasks) e.projectId && !
|
|
3314
|
+
for (let e of n.tasks) e.projectId && !Pr(e.projectId) ? r.add("projects") : e.sectionId ? r.add("sections") : e.parentId ? r.add("subtasks") : r.add("inbox");
|
|
3315
3315
|
let i = "";
|
|
3316
3316
|
if (r.size === 1) {
|
|
3317
3317
|
let e = Array.from(r)[0];
|
|
3318
3318
|
i = e === "inbox" ? "" : `to ${e}`;
|
|
3319
3319
|
} else r.size > 1 && (i = "to multiple contexts");
|
|
3320
|
-
return t.length > 0 ?
|
|
3320
|
+
return t.length > 0 ? Fi({
|
|
3321
3321
|
action: `Added tasks${i ? ` ${i}` : ""}`,
|
|
3322
3322
|
success: e.length,
|
|
3323
3323
|
total: n.tasks.length,
|
|
3324
3324
|
successItems: e.map((e) => e.content ?? "Untitled"),
|
|
3325
3325
|
successLabel: "Created",
|
|
3326
3326
|
failures: t
|
|
3327
|
-
}) :
|
|
3327
|
+
}) : Pi("Added", e, {
|
|
3328
3328
|
context: i,
|
|
3329
3329
|
showDetails: !0
|
|
3330
3330
|
});
|
|
@@ -3471,7 +3471,7 @@ var Ho = {
|
|
|
3471
3471
|
content: Mo.optional().describe("The draft to save with preview: false, all of it: a draft with your edits, or one written from scratch. Anything left out isn't saved. With projectId, it replaces the project's content."),
|
|
3472
3472
|
name: p.string().trim().min(1).optional().describe("The name of the template. Required to save."),
|
|
3473
3473
|
description: p.string().trim().min(1).optional().describe("Required to save. If the user gave none, write a one-sentence summary of the content."),
|
|
3474
|
-
color:
|
|
3474
|
+
color: mi("Unrecognized colors are omitted. Defaults to the project's color, or charcoal."),
|
|
3475
3475
|
workspace: p.string().trim().min(1).optional().describe("Workspace name or ID to save the template to, instead of the user's personal templates. Assignees are kept only when saving a project to its own workspace."),
|
|
3476
3476
|
sharedWithWorkspaceMembers: p.boolean().optional().describe("Share a workspace template with the workspace's members. Defaults to false.")
|
|
3477
3477
|
}, Uo = {
|
|
@@ -3548,14 +3548,14 @@ async function qo({ client: e, projectId: t, file: n, content: r }) {
|
|
|
3548
3548
|
};
|
|
3549
3549
|
}
|
|
3550
3550
|
async function Jo(e, { projectId: t, file: n, content: r, name: i, description: a, color: o, workspace: s, sharedWithWorkspaceMembers: c }) {
|
|
3551
|
-
let [l, u] = await Promise.all([s ?
|
|
3551
|
+
let [l, u] = await Promise.all([s ? sa.resolveWorkspace(e, s).then((e) => e.workspaceId) : void 0, t && (!o || s) ? W(e, t) : void 0]), d = r ? Io(r) : void 0, f;
|
|
3552
3552
|
if (t) {
|
|
3553
3553
|
let n = u && E(u) ? u.workspaceId : void 0;
|
|
3554
3554
|
f = await Xo(() => e.saveProjectAsTemplate({
|
|
3555
3555
|
projectId: t,
|
|
3556
3556
|
name: i,
|
|
3557
3557
|
description: a,
|
|
3558
|
-
color: o ??
|
|
3558
|
+
color: o ?? K.parse(u?.color) ?? "charcoal",
|
|
3559
3559
|
forWorkspace: l && l === n ? !0 : void 0,
|
|
3560
3560
|
content: d
|
|
3561
3561
|
}));
|
|
@@ -3645,7 +3645,7 @@ var Zo = { projectId: p.string().min(1).describe("The ID of the project to analy
|
|
|
3645
3645
|
}
|
|
3646
3646
|
}, es = { ids: p.array(p.string().min(1)).min(1).max(O.BULK_ACTIONS_PER_OPERATION).describe("The IDs of the tasks to complete.") }, ts = {
|
|
3647
3647
|
completed: p.array(p.string()).describe("The IDs of successfully completed tasks."),
|
|
3648
|
-
failures: p.array(
|
|
3648
|
+
failures: p.array(J).describe("Failed task completions with error details."),
|
|
3649
3649
|
totalRequested: p.number().describe("The total number of tasks requested to complete."),
|
|
3650
3650
|
successCount: p.number().describe("The number of successfully completed tasks."),
|
|
3651
3651
|
failureCount: p.number().describe("The number of failed task completions.")
|
|
@@ -3692,7 +3692,7 @@ async function rs(e, t) {
|
|
|
3692
3692
|
return t?.status === "fulfilled" && t.value === "open";
|
|
3693
3693
|
}), o = /* @__PURE__ */ new Map();
|
|
3694
3694
|
if (a.length > 0) {
|
|
3695
|
-
let { outcomes: t } = await
|
|
3695
|
+
let { outcomes: t } = await Q(e, a.map((e) => ({
|
|
3696
3696
|
type: "item_close",
|
|
3697
3697
|
uuid: i(),
|
|
3698
3698
|
args: { id: e }
|
|
@@ -3746,7 +3746,7 @@ function os(e) {
|
|
|
3746
3746
|
return e.checked ? "completed" : "open";
|
|
3747
3747
|
}
|
|
3748
3748
|
function ss({ completed: e, failures: t, args: n }) {
|
|
3749
|
-
return
|
|
3749
|
+
return Fi({
|
|
3750
3750
|
action: "Completed tasks",
|
|
3751
3751
|
success: e.length,
|
|
3752
3752
|
total: n.ids.length,
|
|
@@ -3889,7 +3889,7 @@ var ys = {
|
|
|
3889
3889
|
async execute(e, t, n) {
|
|
3890
3890
|
let r;
|
|
3891
3891
|
if (e.type === "project") {
|
|
3892
|
-
let n = await
|
|
3892
|
+
let n = await W(t, e.id);
|
|
3893
3893
|
if (de(n) && !n.isArchived) throw Error(`Workspace project "${n.name}" must be archived before it can be deleted. Archive the project first, then delete it.`);
|
|
3894
3894
|
r = `Delete the project "${n.name}" and everything in it? ${ps}`;
|
|
3895
3895
|
} else {
|
|
@@ -3978,12 +3978,12 @@ function Ts({ projectId: e, lines: t }) {
|
|
|
3978
3978
|
return i > 0 ? `${n}\n\n${r}\n… ${i} more row${i === 1 ? "" : "s"} in the full content.` : `${n}\n\n${r}`;
|
|
3979
3979
|
}
|
|
3980
3980
|
// src/utils/children.ts
|
|
3981
|
-
var Es =
|
|
3981
|
+
var Es = q.pick({
|
|
3982
3982
|
id: !0,
|
|
3983
3983
|
content: !0,
|
|
3984
3984
|
dueDate: !0,
|
|
3985
3985
|
checked: !0
|
|
3986
|
-
}).extend({ hasChildren: p.boolean().describe("Whether this subtask has subtasks of its own. Fetch it with includeChildren to expand.") }), Ds =
|
|
3986
|
+
}).extend({ hasChildren: p.boolean().describe("Whether this subtask has subtasks of its own. Fetch it with includeChildren to expand.") }), Ds = hi.pick({
|
|
3987
3987
|
id: !0,
|
|
3988
3988
|
name: !0
|
|
3989
3989
|
}).extend({ hasChildren: p.boolean().describe("Whether this sub-project has sub-projects of its own. Fetch it with includeChildren to expand.") }), Os = {
|
|
@@ -4021,7 +4021,7 @@ async function As(e, t) {
|
|
|
4021
4021
|
childCount: 0,
|
|
4022
4022
|
children: []
|
|
4023
4023
|
};
|
|
4024
|
-
let n = await
|
|
4024
|
+
let n = await Rr(e), r = /* @__PURE__ */ new Map();
|
|
4025
4025
|
for (let e of n) {
|
|
4026
4026
|
if (!ue(e) || !e.parentId) continue;
|
|
4027
4027
|
let t = r.get(e.parentId) ?? [];
|
|
@@ -4059,14 +4059,14 @@ var Ns = [
|
|
|
4059
4059
|
"template"
|
|
4060
4060
|
], Ps = {
|
|
4061
4061
|
type: p.enum(Ns).describe("The type of object to fetch."),
|
|
4062
|
-
id: p.string().regex(
|
|
4062
|
+
id: p.string().regex(wa).describe("The unique ID of the object to fetch. For a template, also a gallery slug (\"product-launch\") or a Todoist template URL."),
|
|
4063
4063
|
includeChildren: p.boolean().optional().describe("Also return the direct children of the object: subtasks for a task, sub-projects for a project. Returns childCount plus a compact list, flagging each child that has children of its own. Use this to check whether a task hides subtasks instead of a speculative find-tasks lookup. Ignored for comments, sections and templates.")
|
|
4064
4064
|
}, Fs = p.object({
|
|
4065
4065
|
id: p.string(),
|
|
4066
4066
|
name: p.string(),
|
|
4067
4067
|
description: p.string(),
|
|
4068
|
-
color:
|
|
4069
|
-
...
|
|
4068
|
+
color: K,
|
|
4069
|
+
...Di,
|
|
4070
4070
|
sharedWithWorkspaceMembers: p.boolean().optional(),
|
|
4071
4071
|
canEdit: p.boolean().optional().describe("Whether update-template can change it."),
|
|
4072
4072
|
content: p.record(p.string(), p.unknown()).optional().describe("The template's content, in the shape update-template's `content` takes. Absent for setup templates.")
|
|
@@ -4074,10 +4074,10 @@ var Ns = [
|
|
|
4074
4074
|
type: p.enum(Ns).describe("The type of object fetched."),
|
|
4075
4075
|
id: p.string().describe("The ID of the fetched object."),
|
|
4076
4076
|
object: p.union([
|
|
4077
|
-
|
|
4078
|
-
mi,
|
|
4079
|
-
bi,
|
|
4077
|
+
q,
|
|
4080
4078
|
hi,
|
|
4079
|
+
xi,
|
|
4080
|
+
gi,
|
|
4081
4081
|
Fs
|
|
4082
4082
|
]).describe("The fetched object data."),
|
|
4083
4083
|
...Os
|
|
@@ -4096,7 +4096,7 @@ var Ns = [
|
|
|
4096
4096
|
try {
|
|
4097
4097
|
switch (n) {
|
|
4098
4098
|
case "task": {
|
|
4099
|
-
let [e, a] = await Promise.all([t.getTask(r), i ? js(() => ks(t, r)) : Promise.resolve({})]), o =
|
|
4099
|
+
let [e, a] = await Promise.all([t.getTask(r), i ? js(() => ks(t, r)) : Promise.resolve({})]), o = G(e);
|
|
4100
4100
|
return {
|
|
4101
4101
|
textContent: `Found task: ${o.content} • id=${o.id} • priority=${o.priority} • project=${o.projectId}${Ms("subtasks", a)}`,
|
|
4102
4102
|
structuredContent: {
|
|
@@ -4108,7 +4108,7 @@ var Ns = [
|
|
|
4108
4108
|
};
|
|
4109
4109
|
}
|
|
4110
4110
|
case "project": {
|
|
4111
|
-
let e = await
|
|
4111
|
+
let e = await W(t, r), a = Yr(e), o = i ? await js(() => As(t, e)) : {};
|
|
4112
4112
|
return {
|
|
4113
4113
|
textContent: `Found project: ${a.name} • id=${a.id} • color=${a.color}${a.icon ? ` • icon=${a.icon}` : ""} • viewStyle=${a.viewStyle}${Ms("subProjects", o)}`,
|
|
4114
4114
|
structuredContent: {
|
|
@@ -4120,7 +4120,7 @@ var Ns = [
|
|
|
4120
4120
|
};
|
|
4121
4121
|
}
|
|
4122
4122
|
case "comment": {
|
|
4123
|
-
let e =
|
|
4123
|
+
let e = Xr(await t.getComment(r)), i = e.content.length > 50 ? `${e.content.substring(0, 50)}...` : e.content;
|
|
4124
4124
|
return {
|
|
4125
4125
|
textContent: `Found comment • id=${e.id} • content="${i}" • posted=${e.postedAt}`,
|
|
4126
4126
|
structuredContent: {
|
|
@@ -4133,7 +4133,7 @@ var Ns = [
|
|
|
4133
4133
|
case "section": {
|
|
4134
4134
|
let e = await t.getSection(r);
|
|
4135
4135
|
if (!e) throw Error(`Section ${r} not found.`);
|
|
4136
|
-
let i =
|
|
4136
|
+
let i = _i(e);
|
|
4137
4137
|
return {
|
|
4138
4138
|
textContent: `Found section: ${i.name} • id=${i.id}`,
|
|
4139
4139
|
structuredContent: {
|
|
@@ -4144,7 +4144,7 @@ var Ns = [
|
|
|
4144
4144
|
};
|
|
4145
4145
|
}
|
|
4146
4146
|
case "template": {
|
|
4147
|
-
let e =
|
|
4147
|
+
let e = Ea(r), [i, a] = await Promise.all([t.getTemplate(e), Rs(() => t.getTemplateContent(e))]), o = i.templateType === "setup";
|
|
4148
4148
|
if (!o && a.status === "rejected") throw a.reason;
|
|
4149
4149
|
let s = !o && a.status === "fulfilled" ? No(a.value.content) : void 0;
|
|
4150
4150
|
return {
|
|
@@ -4156,7 +4156,7 @@ var Ns = [
|
|
|
4156
4156
|
id: i.id,
|
|
4157
4157
|
name: i.name,
|
|
4158
4158
|
description: i.longDescription,
|
|
4159
|
-
color:
|
|
4159
|
+
color: K.parse(i.templateColor),
|
|
4160
4160
|
source: i.templateSource,
|
|
4161
4161
|
workspaceId: i.workspaceId ?? void 0,
|
|
4162
4162
|
sharedWithWorkspaceMembers: i.sharedWithWorkspaceMembers,
|
|
@@ -4209,7 +4209,7 @@ var zs = { id: p.string().min(1).describe("A unique identifier for the document
|
|
|
4209
4209
|
if (r === "task") {
|
|
4210
4210
|
let e = await t.getTask(i);
|
|
4211
4211
|
if (e.isDeleted) throw Error(`Task ${i} not found: it has been deleted.`);
|
|
4212
|
-
let n =
|
|
4212
|
+
let n = G(e), r = [n.content];
|
|
4213
4213
|
n.description && r.push(`\n\nDescription: ${n.description}`), n.dueDate && r.push(`\nDue: ${n.dueDate}`), n.labels.length > 0 && r.push(`\nLabels: ${n.labels.join(", ")}`), a = {
|
|
4214
4214
|
id: `task:${n.id}`,
|
|
4215
4215
|
title: n.content,
|
|
@@ -4229,7 +4229,7 @@ var zs = { id: p.string().min(1).describe("A unique identifier for the document
|
|
|
4229
4229
|
}
|
|
4230
4230
|
};
|
|
4231
4231
|
} else {
|
|
4232
|
-
let e =
|
|
4232
|
+
let e = Yr(await W(t, i)), n = [e.name];
|
|
4233
4233
|
e.description && n.push(`\n\nDescription: ${e.description}`), e.isShared && n.push("\n\nShared project"), e.isFavorite && n.push("\nFavorite: Yes"), a = {
|
|
4234
4234
|
id: `project:${e.id}`,
|
|
4235
4235
|
title: e.name,
|
|
@@ -4252,7 +4252,7 @@ var zs = { id: p.string().min(1).describe("A unique identifier for the document
|
|
|
4252
4252
|
}
|
|
4253
4253
|
}, Hs = p.union([p.iso.date(), p.iso.datetime({ offset: !0 })]);
|
|
4254
4254
|
function Us(e) {
|
|
4255
|
-
return
|
|
4255
|
+
return Z(e).pipe(Hs.optional());
|
|
4256
4256
|
}
|
|
4257
4257
|
var Ws = {
|
|
4258
4258
|
objectType: p.enum(g).optional().describe("Type of object to filter by."),
|
|
@@ -4266,7 +4266,7 @@ var Ws = {
|
|
|
4266
4266
|
limit: p.number().int().min(1).max(D.ACTIVITY_MAX).default(D.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
|
|
4267
4267
|
cursor: p.string().optional().describe("Pagination cursor for retrieving the next page of results.")
|
|
4268
4268
|
}, Gs = {
|
|
4269
|
-
events: p.array(
|
|
4269
|
+
events: p.array(Si).describe("The activity events."),
|
|
4270
4270
|
nextCursor: p.string().optional(),
|
|
4271
4271
|
totalCount: p.number().describe("The total number of events in this page."),
|
|
4272
4272
|
hasMore: p.boolean(),
|
|
@@ -4289,7 +4289,7 @@ var Ws = {
|
|
|
4289
4289
|
cursor: d ?? null
|
|
4290
4290
|
};
|
|
4291
4291
|
n && i ? f.objectEventTypes = `${n}:${i}` : n ? f.objectEventTypes = `${n}:` : i && (f.objectEventTypes = `:${i}`), r && r !== "remove" && (f.objectId = r), a && (f.parentProjectId = a), o && (f.parentItemId = o), s && (f.initiatorId = s), c && (f.dateFrom = c), l && (f.dateTo = l);
|
|
4292
|
-
let { results: p, nextCursor: m } = await t.getActivityLogs(f), h = p.map(
|
|
4292
|
+
let { results: p, nextCursor: m } = await t.getActivityLogs(f), h = p.map(Zr), _ = h.length > 0 ? await Ys(t) : void 0, v = Xs(_);
|
|
4293
4293
|
return {
|
|
4294
4294
|
textContent: Zs({
|
|
4295
4295
|
events: h,
|
|
@@ -4336,7 +4336,7 @@ function Zs({ events: e, args: t, nextCursor: n, initiatorNames: r, timeZone: i
|
|
|
4336
4336
|
let s = [];
|
|
4337
4337
|
t.objectId && s.push(`object ID: ${t.objectId}`), t.projectId && s.push(`project: ${t.projectId}`), t.taskId && s.push(`task: ${t.taskId}`), t.initiatorId && s.push(`initiator: ${t.initiatorId}`), t.dateFrom && s.push(`from: ${t.dateFrom}`), t.dateTo && s.push(`until (exclusive): ${t.dateTo}`);
|
|
4338
4338
|
let c = [];
|
|
4339
|
-
return e.length === 0 && (c.push("No activity events match the specified filters"), c.push("Note: Activity logs only show recent events"), t.eventType && c.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && c.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && c.push("Verify the object ID is correct")),
|
|
4339
|
+
return e.length === 0 && (c.push("No activity events match the specified filters"), c.push("Note: Activity logs only show recent events"), t.eventType && c.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && c.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && c.push("Verify the object ID is correct")), X({
|
|
4340
4340
|
subject: a,
|
|
4341
4341
|
count: e.length,
|
|
4342
4342
|
limit: t.limit,
|
|
@@ -4396,7 +4396,7 @@ var tc = {
|
|
|
4396
4396
|
cursor: p.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
4397
4397
|
limit: p.number().int().min(1).max(D.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
4398
4398
|
}, nc = {
|
|
4399
|
-
comments: p.array(
|
|
4399
|
+
comments: p.array(xi).describe("The found comments."),
|
|
4400
4400
|
searchType: p.string().describe("The type of search performed: \"single\" (comment ID), \"task\" (task ID), or \"project\" (project ID)."),
|
|
4401
4401
|
searchId: p.string().describe("The ID that was searched for (comment, task, or project ID)."),
|
|
4402
4402
|
hasMore: p.boolean(),
|
|
@@ -4413,14 +4413,14 @@ var tc = {
|
|
|
4413
4413
|
idempotentHint: !0
|
|
4414
4414
|
},
|
|
4415
4415
|
async execute(e, t) {
|
|
4416
|
-
let n =
|
|
4416
|
+
let n = $r(e.cursor), r = [
|
|
4417
4417
|
e.taskId,
|
|
4418
4418
|
e.projectId,
|
|
4419
4419
|
e.commentId
|
|
4420
4420
|
].filter(Boolean);
|
|
4421
4421
|
if (r.length === 0) throw Error("Must provide exactly one of: taskId, projectId, or commentId.");
|
|
4422
4422
|
if (r.length > 1) throw Error("Cannot provide multiple search parameters. Choose one of: taskId, projectId, or commentId.");
|
|
4423
|
-
let i = await
|
|
4423
|
+
let i = await Fr({
|
|
4424
4424
|
projectId: e.projectId,
|
|
4425
4425
|
client: t
|
|
4426
4426
|
}), a = !1, o = null, s;
|
|
@@ -4440,7 +4440,7 @@ var tc = {
|
|
|
4440
4440
|
});
|
|
4441
4441
|
s = r.results, a = r.nextCursor !== null, o = r.nextCursor;
|
|
4442
4442
|
} else throw Error("Invalid state: no search parameter provided");
|
|
4443
|
-
let c = s.map(
|
|
4443
|
+
let c = s.map(Xr);
|
|
4444
4444
|
return {
|
|
4445
4445
|
textContent: ic({
|
|
4446
4446
|
comments: c,
|
|
@@ -4472,7 +4472,7 @@ function ic({ comments: e, searchType: t, searchId: n, hasMore: r, nextCursor: i
|
|
|
4472
4472
|
a = `Found ${e.length} ${s} for ${t} ${n}${o}`, r && (a += " • More available");
|
|
4473
4473
|
}
|
|
4474
4474
|
if (i) {
|
|
4475
|
-
let e =
|
|
4475
|
+
let e = Bi([], i);
|
|
4476
4476
|
return `${a}\n${e}`;
|
|
4477
4477
|
}
|
|
4478
4478
|
return a;
|
|
@@ -4526,7 +4526,7 @@ var mc = {
|
|
|
4526
4526
|
cursor: p.string().optional().describe("The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."),
|
|
4527
4527
|
...ac
|
|
4528
4528
|
}, hc = {
|
|
4529
|
-
tasks: p.array(
|
|
4529
|
+
tasks: p.array(q).describe("The found completed tasks."),
|
|
4530
4530
|
nextCursor: p.string().optional(),
|
|
4531
4531
|
totalCount: p.number().describe("The total number of tasks in this page."),
|
|
4532
4532
|
hasMore: p.boolean(),
|
|
@@ -4542,11 +4542,11 @@ var mc = {
|
|
|
4542
4542
|
idempotentHint: !0
|
|
4543
4543
|
},
|
|
4544
4544
|
async execute(e, t) {
|
|
4545
|
-
let { getBy: n, labels: r, labelsOperator: i, since: a, until: o, responsibleUser: s, projectId: c, cursor: l, ...u } = e, d =
|
|
4545
|
+
let { getBy: n, labels: r, labelsOperator: i, since: a, until: o, responsibleUser: s, projectId: c, cursor: l, ...u } = e, d = $r(l);
|
|
4546
4546
|
if (d && (!a || !o)) throw Error("Cursor pagination requires explicit since and until. Reuse structuredContent.appliedFilters.since and structuredContent.appliedFilters.until from the previous page.");
|
|
4547
4547
|
let f = await Ar(t, s), p = f?.email, m = sc(r, i);
|
|
4548
4548
|
f && p && (m = jr(m, `assigned to: ${p}`));
|
|
4549
|
-
let h = await t.getUser(), g = h.tzInfo?.gmtString || "+00:00", _ = await
|
|
4549
|
+
let h = await t.getUser(), g = h.tzInfo?.gmtString || "+00:00", _ = await Fr({
|
|
4550
4550
|
projectId: c,
|
|
4551
4551
|
user: h
|
|
4552
4552
|
}), v = pc({
|
|
@@ -4581,7 +4581,7 @@ var mc = {
|
|
|
4581
4581
|
filterQuery: m,
|
|
4582
4582
|
filterLang: "en"
|
|
4583
4583
|
} : {}
|
|
4584
|
-
}), w = C.map(
|
|
4584
|
+
}), w = C.map(G);
|
|
4585
4585
|
return {
|
|
4586
4586
|
textContent: _c({
|
|
4587
4587
|
tasks: w,
|
|
@@ -4613,14 +4613,14 @@ function _c({ tasks: e, args: t, userGmtOffset: n, userTimezone: r, nextCursor:
|
|
|
4613
4613
|
l.push(`assigned to: ${e}`);
|
|
4614
4614
|
}
|
|
4615
4615
|
let u = [];
|
|
4616
|
-
return e.length === 0 && (u.push("No tasks completed in this date range"), u.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && u.push("Try removing project/section/parent filters"), t.getBy === "due" && u.push("Try switching to \"completion\" date instead")),
|
|
4616
|
+
return e.length === 0 && (u.push("No tasks completed in this date range"), u.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && u.push("Try removing project/section/parent filters"), t.getBy === "due" && u.push("Try switching to \"completion\" date instead")), X({
|
|
4617
4617
|
subject: c,
|
|
4618
4618
|
count: e.length,
|
|
4619
4619
|
limit: t.limit,
|
|
4620
4620
|
nextCursor: i ?? void 0,
|
|
4621
4621
|
filterHints: l,
|
|
4622
4622
|
notes: [vc(t, n, r)],
|
|
4623
|
-
previewLines:
|
|
4623
|
+
previewLines: zi(e, Math.min(e.length, t.limit), o),
|
|
4624
4624
|
zeroReasonHints: u
|
|
4625
4625
|
});
|
|
4626
4626
|
}
|
|
@@ -4636,7 +4636,7 @@ function vc(e, t, n) {
|
|
|
4636
4636
|
}
|
|
4637
4637
|
// src/tools/find-folders.ts
|
|
4638
4638
|
var { ADD_FOLDERS: yc, FIND_PROJECTS: bc, LIST_WORKSPACES: xc } = B, Sc = { workspace: p.string().trim().min(1).optional().describe(`The workspace to list folders for, by name or ID (see ${xc}). Omit to list the folders of every workspace.`) }, Cc = {
|
|
4639
|
-
folders: p.array(
|
|
4639
|
+
folders: p.array(vi).describe("In sidebar order within each workspace."),
|
|
4640
4640
|
totalCount: p.number()
|
|
4641
4641
|
}, wc = {
|
|
4642
4642
|
name: B.FIND_FOLDERS,
|
|
@@ -4649,7 +4649,7 @@ var { ADD_FOLDERS: yc, FIND_PROJECTS: bc, LIST_WORKSPACES: xc } = B, Sc = { work
|
|
|
4649
4649
|
idempotentHint: !0
|
|
4650
4650
|
},
|
|
4651
4651
|
async execute({ workspace: e }, t) {
|
|
4652
|
-
let n = e ? [await
|
|
4652
|
+
let n = e ? [await sa.resolveWorkspace(t, e)] : await sa.listWorkspaces(t), r = await Promise.all(n.map(async (e) => ({
|
|
4653
4653
|
...e,
|
|
4654
4654
|
folders: await Tc(t, e.workspaceId)
|
|
4655
4655
|
}))), i = r.flatMap((e) => e.folders);
|
|
@@ -4663,14 +4663,14 @@ var { ADD_FOLDERS: yc, FIND_PROJECTS: bc, LIST_WORKSPACES: xc } = B, Sc = { work
|
|
|
4663
4663
|
}
|
|
4664
4664
|
};
|
|
4665
4665
|
async function Tc(e, t) {
|
|
4666
|
-
return (await
|
|
4666
|
+
return (await U({
|
|
4667
4667
|
apiMethod: (t) => R(() => e.getFolders(t)),
|
|
4668
4668
|
args: { workspaceId: t },
|
|
4669
4669
|
limit: D.FOLDERS_MAX
|
|
4670
|
-
})).sort((e, t) => e.defaultOrder - t.defaultOrder).map(
|
|
4670
|
+
})).sort((e, t) => e.defaultOrder - t.defaultOrder).map(yi);
|
|
4671
4671
|
}
|
|
4672
4672
|
function Ec(e) {
|
|
4673
|
-
return e.length === 0 ? "The user is not in any workspace. Folders exist only in workspaces; personal projects nest under a parent project instead." : e.map(({ workspaceId: e, workspaceName: t, folders: n }) =>
|
|
4673
|
+
return e.length === 0 ? "The user is not in any workspace. Folders exist only in workspaces; personal projects nest under a parent project instead." : e.map(({ workspaceId: e, workspaceName: t, folders: n }) => X({
|
|
4674
4674
|
subject: `Folders in ${t} (id=${e})`,
|
|
4675
4675
|
count: n.length,
|
|
4676
4676
|
previewLines: n.map((e) => ` ${e.name} • id=${e.id}`).join("\n"),
|
|
@@ -4683,7 +4683,7 @@ var Dc = {
|
|
|
4683
4683
|
limit: p.number().int().min(1).max(D.LABELS_MAX).default(D.LABELS_DEFAULT).describe("The maximum number of labels to return."),
|
|
4684
4684
|
cursor: p.string().optional().describe("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.")
|
|
4685
4685
|
}, Oc = {
|
|
4686
|
-
labels: p.array(
|
|
4686
|
+
labels: p.array(wi).describe("The found personal labels."),
|
|
4687
4687
|
nextCursor: p.string().optional(),
|
|
4688
4688
|
totalCount: p.number().describe("The total number of labels in this page."),
|
|
4689
4689
|
hasMore: p.boolean(),
|
|
@@ -4700,13 +4700,13 @@ var Dc = {
|
|
|
4700
4700
|
idempotentHint: !0
|
|
4701
4701
|
},
|
|
4702
4702
|
async execute(e, t) {
|
|
4703
|
-
let [n, r] = await Promise.all([e.searchText ?
|
|
4703
|
+
let [n, r] = await Promise.all([e.searchText ? Gr(t, e.searchText).then((e) => ({
|
|
4704
4704
|
results: e,
|
|
4705
4705
|
nextCursor: null
|
|
4706
4706
|
})) : t.getLabels({
|
|
4707
4707
|
limit: e.limit,
|
|
4708
4708
|
cursor: e.cursor ?? null
|
|
4709
|
-
}),
|
|
4709
|
+
}), qr(t)]), { results: i, nextCursor: a } = n, o = e.searchText ? { searchText: e.searchText } : {
|
|
4710
4710
|
limit: e.limit,
|
|
4711
4711
|
cursor: e.cursor
|
|
4712
4712
|
};
|
|
@@ -4718,7 +4718,7 @@ var Dc = {
|
|
|
4718
4718
|
sharedLabels: r
|
|
4719
4719
|
}),
|
|
4720
4720
|
structuredContent: {
|
|
4721
|
-
labels: i.map((e) =>
|
|
4721
|
+
labels: i.map((e) => wi.parse(e)),
|
|
4722
4722
|
nextCursor: a ?? void 0,
|
|
4723
4723
|
totalCount: i.length,
|
|
4724
4724
|
hasMore: !!a,
|
|
@@ -4731,10 +4731,10 @@ var Dc = {
|
|
|
4731
4731
|
function Ac({ labels: e, args: t, nextCursor: n, sharedLabels: r }) {
|
|
4732
4732
|
let i = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", a = [];
|
|
4733
4733
|
t.searchText && a.push(`searchText: "${t.searchText}"`);
|
|
4734
|
-
let o = e.slice(0, 10).map(
|
|
4734
|
+
let o = e.slice(0, 10).map(Li).join("\n"), s = e.length - 10, c = s > 0 ? `${o}\n …and ${s} more` : o, l = [];
|
|
4735
4735
|
e.length === 0 && (t.searchText ? (l.push("Try broader search terms"), l.push("Check spelling"), l.push("Remove searchText to see all labels")) : l.push("No personal labels created yet"));
|
|
4736
4736
|
let u = r.length > 0 ? `\nShared labels (${r.length}): ${r.join(", ")}` : "\nNo shared labels.";
|
|
4737
|
-
return
|
|
4737
|
+
return X({
|
|
4738
4738
|
subject: i,
|
|
4739
4739
|
count: e.length,
|
|
4740
4740
|
limit: t.searchText ? void 0 : t.limit,
|
|
@@ -4749,7 +4749,7 @@ var { FIND_PROJECTS: jc, ADD_TASKS: Mc, UPDATE_TASKS: Nc } = B, Pc = {
|
|
|
4749
4749
|
projectId: p.string().min(1).optional().describe("Optional. If provided, searches only collaborators of this project. If omitted, searches across the collaborators of all shared projects the authenticated user can access (plus the authenticated user themselves) — use this for general \"find a user\" / \"who is X\" lookups."),
|
|
4750
4750
|
searchTerm: p.string().optional().describe("Search for a user by name or email (partial and case insensitive match). If omitted, all users are returned.")
|
|
4751
4751
|
}, Fc = {
|
|
4752
|
-
collaborators: p.array(
|
|
4752
|
+
collaborators: p.array(Ci).describe("The found users."),
|
|
4753
4753
|
projectInfo: p.object({
|
|
4754
4754
|
id: p.string().describe("The project ID."),
|
|
4755
4755
|
name: p.string().describe("The project name."),
|
|
@@ -4777,7 +4777,7 @@ var { FIND_PROJECTS: jc, ADD_TASKS: Mc, UPDATE_TASKS: Nc } = B, Pc = {
|
|
|
4777
4777
|
});
|
|
4778
4778
|
let i = n, a;
|
|
4779
4779
|
try {
|
|
4780
|
-
if (a = await
|
|
4780
|
+
if (a = await W(t, n), !a) throw Error(`Project with ID "${n}" not found or not accessible`);
|
|
4781
4781
|
if (i = a.name, !a.isShared) return {
|
|
4782
4782
|
textContent: `Project "${i}" is not shared and has no collaborators.\n\n**Next steps:**\n• Share the project to enable collaboration\n• Use ${Mc} and ${Nc} for assignment features once shared`,
|
|
4783
4783
|
structuredContent: {
|
|
@@ -4884,7 +4884,7 @@ function Bc({ collaborators: e, projectName: t, searchTerm: n, totalAvailable: r
|
|
|
4884
4884
|
let l = [];
|
|
4885
4885
|
e.length === 0 && n && (l.push(`No users match "${n}"`), l.push("Try a broader search term or check spelling"), r > 0 && l.push(`${r} users available without filter`));
|
|
4886
4886
|
let u = [];
|
|
4887
|
-
return e.length > 0 ? (u.push(`Use ${Mc} with responsibleUser to assign new tasks`), u.push(`Use ${Nc} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${jc} to find other projects`), n && r > 0 && u.push("Try searching without filters to see all users")),
|
|
4887
|
+
return e.length > 0 ? (u.push(`Use ${Mc} with responsibleUser to assign new tasks`), u.push(`Use ${Nc} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${jc} to find other projects`), n && r > 0 && u.push("Try searching without filters to see all users")), X({
|
|
4888
4888
|
subject: o,
|
|
4889
4889
|
count: e.length,
|
|
4890
4890
|
filterHints: s,
|
|
@@ -4915,7 +4915,7 @@ var { ADD_PROJECTS: Vc, FIND_FOLDERS: Hc, PROJECT_MANAGEMENT: Uc } = B, Wc = {
|
|
|
4915
4915
|
workspaceId: p.string(),
|
|
4916
4916
|
url: p.string()
|
|
4917
4917
|
}), qc = {
|
|
4918
|
-
projects: p.array(
|
|
4918
|
+
projects: p.array(hi).describe("The found projects."),
|
|
4919
4919
|
nextCursor: p.string().optional(),
|
|
4920
4920
|
totalCount: p.number().describe("The total number of projects in this page."),
|
|
4921
4921
|
hasMore: p.boolean(),
|
|
@@ -4935,7 +4935,7 @@ var { ADD_PROJECTS: Vc, FIND_FOLDERS: Hc, PROJECT_MANAGEMENT: Uc } = B, Wc = {
|
|
|
4935
4935
|
async execute(e, t) {
|
|
4936
4936
|
let { searchText: n } = e, r = e.archivedStatus ?? "active", i, a = null;
|
|
4937
4937
|
if (Yc(e)) {
|
|
4938
|
-
let a = Promise.resolve([]), [o, s] = await Promise.all([r === "archived" ? a : n ?
|
|
4938
|
+
let a = Promise.resolve([]), [o, s] = await Promise.all([r === "archived" ? a : n ? Lr(t, n) : Rr(t, e.folderId), r === "active" ? a : Hr(t)]), c = n ? Wr(n) : null, l = c ? s.filter((e) => c.test(e.name)) : s, { folderId: u } = e, d = [...o, ...l];
|
|
4939
4939
|
i = u ? d.filter((e) => E(e) && e.folderId === u) : d;
|
|
4940
4940
|
} else {
|
|
4941
4941
|
let n = r === "archived" ? await t.getArchivedProjects({
|
|
@@ -4948,7 +4948,7 @@ var { ADD_PROJECTS: Vc, FIND_FOLDERS: Hc, PROJECT_MANAGEMENT: Uc } = B, Wc = {
|
|
|
4948
4948
|
});
|
|
4949
4949
|
i = n.results, a = n.nextCursor;
|
|
4950
4950
|
}
|
|
4951
|
-
let o = i.map(
|
|
4951
|
+
let o = i.map(Yr), s = await Zc(t, e, o.length);
|
|
4952
4952
|
return {
|
|
4953
4953
|
textContent: $c({
|
|
4954
4954
|
projects: o,
|
|
@@ -4979,12 +4979,12 @@ async function Zc(e, t, n) {
|
|
|
4979
4979
|
if (!Xc(t) || !(r || o)) return;
|
|
4980
4980
|
let s;
|
|
4981
4981
|
try {
|
|
4982
|
-
s = await
|
|
4982
|
+
s = await zr(e);
|
|
4983
4983
|
} catch (e) {
|
|
4984
4984
|
if (r) throw e;
|
|
4985
4985
|
return;
|
|
4986
4986
|
}
|
|
4987
|
-
let c = i ?
|
|
4987
|
+
let c = i ? Wr(i) : null, { folderId: l } = t, u = s.filter((e) => (!c || c.test(e.name)) && (!l || e.folderId === l));
|
|
4988
4988
|
return {
|
|
4989
4989
|
listed: u.slice(0, a),
|
|
4990
4990
|
total: u.length
|
|
@@ -5001,9 +5001,9 @@ function Qc({ id: e, name: t, workspaceId: n, url: r }) {
|
|
|
5001
5001
|
function $c({ projects: e, args: t, nextCursor: n, unjoined: r }) {
|
|
5002
5002
|
let i = Wc[t.archivedStatus ?? "active"], a = t.searchText ? `All ${i} matching "${t.searchText}"` : `${i.charAt(0).toUpperCase()}${i.slice(1)}`, o = [];
|
|
5003
5003
|
t.searchText && o.push(`searchText: "${t.searchText}"`), t.archivedStatus && t.archivedStatus !== "active" && o.push(`archivedStatus: "${t.archivedStatus}"`), t.folderId && o.push(`folderId: "${t.folderId}"`);
|
|
5004
|
-
let s = e.slice(0, 10).map(
|
|
5004
|
+
let s = e.slice(0, 10).map(Ri).join("\n"), c = e.length - 10, l = c > 0 ? `${s}\n …and ${c} more` : s, u = [], d = t.folderId ? " in this folder" : "";
|
|
5005
5005
|
e.length === 0 && (t.searchText && r?.total ? u.push("None of the projects the user has joined match") : t.searchText ? (r ? u.push("No workspace project the user hasn't joined matches either") : Xc(t) && u.push("Set includeUnjoined to also search workspace projects the user hasn't joined"), u.push("Try broader search terms"), u.push("Check spelling"), u.push("Remove searchText to see all projects")) : t.folderId && r?.total ? u.push("None of the projects the user has joined are in this folder") : t.archivedStatus === "archived" ? (u.push(`No archived projects${d}`), u.push("Use archivedStatus: 'all' to also see active projects")) : t.archivedStatus === "all" ? (u.push(t.folderId ? "No projects in this folder" : "No projects created yet"), t.folderId || u.push(`Use ${Vc} to create a project`)) : (u.push(`No active projects${d}`), u.push("Use archivedStatus: 'all' to include archived projects"), t.folderId || u.push(`Use ${Vc} to create a project`)), t.folderId && !r?.total && u.push(`Use ${Hc} to check the folder ID`));
|
|
5006
|
-
let f =
|
|
5006
|
+
let f = X({
|
|
5007
5007
|
subject: a,
|
|
5008
5008
|
count: e.length,
|
|
5009
5009
|
limit: Yc(t) ? void 0 : t.limit,
|
|
@@ -5027,7 +5027,7 @@ var el = {
|
|
|
5027
5027
|
reminderId: p.string().optional().describe("Get a specific time-based reminder (relative or absolute) by its ID."),
|
|
5028
5028
|
locationReminderId: p.string().optional().describe("Get a specific location reminder by its ID.")
|
|
5029
5029
|
}, tl = {
|
|
5030
|
-
reminders: p.array(
|
|
5030
|
+
reminders: p.array(Ei).describe("The found reminders (time-based and location)."),
|
|
5031
5031
|
searchType: p.string().describe("The search type used: \"task\", \"reminder\", or \"location_reminder\"."),
|
|
5032
5032
|
searchId: p.string().describe("The ID used for the search."),
|
|
5033
5033
|
totalCount: p.number().describe("Total reminders in this response.")
|
|
@@ -5050,7 +5050,7 @@ var el = {
|
|
|
5050
5050
|
if (a.length === 0) throw Error("One of taskId, reminderId, or locationReminderId must be provided.");
|
|
5051
5051
|
if (a.length > 1) throw Error("Only one of taskId, reminderId, or locationReminderId can be provided at a time.");
|
|
5052
5052
|
if (r) {
|
|
5053
|
-
let e = await t.getReminder(r), n =
|
|
5053
|
+
let e = await t.getReminder(r), n = ni(e);
|
|
5054
5054
|
return {
|
|
5055
5055
|
textContent: `Found ${e.type} reminder (id=${r})`,
|
|
5056
5056
|
structuredContent: {
|
|
@@ -5062,7 +5062,7 @@ var el = {
|
|
|
5062
5062
|
};
|
|
5063
5063
|
}
|
|
5064
5064
|
if (i) {
|
|
5065
|
-
let e =
|
|
5065
|
+
let e = ni(await t.getLocationReminder(i));
|
|
5066
5066
|
return {
|
|
5067
5067
|
textContent: `Found location reminder (id=${i})`,
|
|
5068
5068
|
structuredContent: {
|
|
@@ -5074,13 +5074,13 @@ var el = {
|
|
|
5074
5074
|
};
|
|
5075
5075
|
}
|
|
5076
5076
|
if (n) {
|
|
5077
|
-
let [e, r] = await Promise.all([
|
|
5077
|
+
let [e, r] = await Promise.all([U({
|
|
5078
5078
|
apiMethod: (e) => t.getReminders(e),
|
|
5079
5079
|
args: { taskId: n }
|
|
5080
|
-
}),
|
|
5080
|
+
}), U({
|
|
5081
5081
|
apiMethod: (e) => t.getLocationReminders(e),
|
|
5082
5082
|
args: { taskId: n }
|
|
5083
|
-
})]), i = [...e, ...r].map(
|
|
5083
|
+
})]), i = [...e, ...r].map(ni);
|
|
5084
5084
|
return {
|
|
5085
5085
|
textContent: rl(i, n),
|
|
5086
5086
|
structuredContent: {
|
|
@@ -5096,7 +5096,7 @@ var el = {
|
|
|
5096
5096
|
};
|
|
5097
5097
|
function rl(e, t) {
|
|
5098
5098
|
if (e.length === 0) return `No reminders found for task ${t}`;
|
|
5099
|
-
let { timeBasedCount: n, locationCount: r } =
|
|
5099
|
+
let { timeBasedCount: n, locationCount: r } = ri(e), i = [];
|
|
5100
5100
|
if (n > 0) {
|
|
5101
5101
|
let e = n > 1 ? "time-based reminders" : "time-based reminder";
|
|
5102
5102
|
i.push(`${n} ${e}`);
|
|
@@ -5120,7 +5120,7 @@ var { ADD_SECTIONS: il } = B, al = {
|
|
|
5120
5120
|
"archived",
|
|
5121
5121
|
"all"
|
|
5122
5122
|
]).optional().describe("Default 'active'. 'archived' returns only archived sections, 'all' both.")
|
|
5123
|
-
}, sl =
|
|
5123
|
+
}, sl = gi.extend({ isArchived: p.boolean() }), cl = {
|
|
5124
5124
|
sections: p.array(sl).describe("The found sections."),
|
|
5125
5125
|
totalCount: p.number().describe("The total number of sections found."),
|
|
5126
5126
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
@@ -5135,10 +5135,10 @@ var { ADD_SECTIONS: il } = B, al = {
|
|
|
5135
5135
|
idempotentHint: !0
|
|
5136
5136
|
},
|
|
5137
5137
|
async execute(e, t) {
|
|
5138
|
-
let n = await
|
|
5138
|
+
let n = await Fr({
|
|
5139
5139
|
projectId: e.projectId,
|
|
5140
5140
|
client: t
|
|
5141
|
-
}) ?? e.projectId, r = e.archivedStatus ?? "active", i = Promise.resolve([]), [a, o] = await Promise.all([r === "archived" ? i : ul(t, n, e.searchText), r === "active" ? i :
|
|
5141
|
+
}) ?? e.projectId, r = e.archivedStatus ?? "active", i = Promise.resolve([]), [a, o] = await Promise.all([r === "archived" ? i : ul(t, n, e.searchText), r === "active" ? i : Ur(t, n)]), s = e.searchText ? Wr(e.searchText) : null, c = s ? o.filter((e) => s.test(e.name)) : o, l = [...a, ...c].map(dl);
|
|
5142
5142
|
return {
|
|
5143
5143
|
textContent: fl({
|
|
5144
5144
|
sections: l,
|
|
@@ -5155,11 +5155,11 @@ var { ADD_SECTIONS: il } = B, al = {
|
|
|
5155
5155
|
}
|
|
5156
5156
|
};
|
|
5157
5157
|
async function ul(e, t, n) {
|
|
5158
|
-
return n ?
|
|
5158
|
+
return n ? Jr(e, n, t) : (await e.getSections({ projectId: t })).results;
|
|
5159
5159
|
}
|
|
5160
5160
|
function dl(e) {
|
|
5161
5161
|
return {
|
|
5162
|
-
...
|
|
5162
|
+
..._i(e),
|
|
5163
5163
|
isArchived: e.isArchived
|
|
5164
5164
|
};
|
|
5165
5165
|
}
|
|
@@ -5170,7 +5170,7 @@ function fl({ sections: e, projectId: t, searchText: n, archivedStatus: r }) {
|
|
|
5170
5170
|
let t = e.isArchived ? " • Archived" : "";
|
|
5171
5171
|
return ` ${e.name}${t} • id=${e.id}`;
|
|
5172
5172
|
}).join("\n") : void 0;
|
|
5173
|
-
return
|
|
5173
|
+
return X({
|
|
5174
5174
|
subject: o,
|
|
5175
5175
|
count: e.length,
|
|
5176
5176
|
previewLines: s,
|
|
@@ -5204,7 +5204,7 @@ var gl = {
|
|
|
5204
5204
|
responsibleUserFiltering: p.enum(kr).optional().describe("Filter when responsibleUser is omitted. 'assigned'=assigned to others; 'unassignedOrMe'=unassigned+mine; 'all'=everyone. Default: 'unassignedOrMe'."),
|
|
5205
5205
|
...ac
|
|
5206
5206
|
}, _l = {
|
|
5207
|
-
tasks: p.array(
|
|
5207
|
+
tasks: p.array(q).describe("The found tasks."),
|
|
5208
5208
|
nextCursor: p.string().optional(),
|
|
5209
5209
|
totalCount: p.number().describe("The total number of tasks in this page."),
|
|
5210
5210
|
hasMore: p.boolean(),
|
|
@@ -5223,7 +5223,7 @@ var gl = {
|
|
|
5223
5223
|
let n = e.startDate !== void 0 || e.overdueOption === "overdue-only" ? e : {
|
|
5224
5224
|
...e,
|
|
5225
5225
|
startDate: "today"
|
|
5226
|
-
}, r =
|
|
5226
|
+
}, r = $r(n.cursor), i = await Ar(t, n.responsibleUser), a = i?.userId, o = i?.email, s = n.responsibleUser?.trim().toLowerCase() === "me", c = a && !s ? await t.getUser() : void 0, l = s ? a : c?.id, u = "";
|
|
5227
5227
|
if (n.overdueOption === "overdue-only") u = "overdue";
|
|
5228
5228
|
else if (n.startDate === "today") {
|
|
5229
5229
|
if (n.daysCount > 1) {
|
|
@@ -5243,7 +5243,7 @@ var gl = {
|
|
|
5243
5243
|
responsibleUserFiltering: n.responsibleUserFiltering
|
|
5244
5244
|
});
|
|
5245
5245
|
u = jr(u, f);
|
|
5246
|
-
let { tasks: p, nextCursor: m } = await
|
|
5246
|
+
let { tasks: p, nextCursor: m } = await ei({
|
|
5247
5247
|
client: t,
|
|
5248
5248
|
query: u,
|
|
5249
5249
|
cursor: r,
|
|
@@ -5300,13 +5300,13 @@ function yl({ tasks: e, args: t, nextCursor: n, assigneeEmail: r, assigneeNames:
|
|
|
5300
5300
|
s.push(`Great job! No tasks for ${Pn(t.daysCount).toLowerCase()}${e}`);
|
|
5301
5301
|
} else s.push("Expand date range with larger 'daysCount'"), s.push("Check today's tasks with startDate='today'");
|
|
5302
5302
|
}
|
|
5303
|
-
return
|
|
5303
|
+
return X({
|
|
5304
5304
|
subject: o,
|
|
5305
5305
|
count: e.length,
|
|
5306
5306
|
limit: t.limit,
|
|
5307
5307
|
nextCursor: n ?? void 0,
|
|
5308
5308
|
filterHints: a,
|
|
5309
|
-
previewLines:
|
|
5309
|
+
previewLines: zi(e, Math.min(e.length, t.limit), i),
|
|
5310
5310
|
zeroReasonHints: s
|
|
5311
5311
|
});
|
|
5312
5312
|
}
|
|
@@ -5377,7 +5377,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5377
5377
|
filterIdOrName: p.string().optional().describe("The ID or name of a saved Todoist filter. The filter's query will be fetched and used to find tasks. Cannot be used with the `filter` parameter, projectId, sectionId, or parentId."),
|
|
5378
5378
|
...ac
|
|
5379
5379
|
}, Al = {
|
|
5380
|
-
tasks: p.array(
|
|
5380
|
+
tasks: p.array(q).describe("The found tasks."),
|
|
5381
5381
|
nextCursor: p.string().optional(),
|
|
5382
5382
|
totalCount: p.number().describe("The total number of tasks in this page."),
|
|
5383
5383
|
hasMore: p.boolean(),
|
|
@@ -5393,7 +5393,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5393
5393
|
idempotentHint: !0
|
|
5394
5394
|
},
|
|
5395
5395
|
async execute(e, t) {
|
|
5396
|
-
let { searchText: n, projectId: r, sectionId: i, parentId: a, responsibleUser: o, responsibleUserFiltering: s, limit: c, cursor: l, labels: u, labelsOperator: d, filter: f, filterIdOrName: p } = e, m =
|
|
5396
|
+
let { searchText: n, projectId: r, sectionId: i, parentId: a, responsibleUser: o, responsibleUserFiltering: s, limit: c, cursor: l, labels: u, labelsOperator: d, filter: f, filterIdOrName: p } = e, m = $r(l);
|
|
5397
5397
|
if (f && p) throw Error("The `filter` and `filterIdOrName` parameters cannot be used together. Provide only one.");
|
|
5398
5398
|
let h = !!(r || i || a);
|
|
5399
5399
|
if ((f || p) && h) throw Error("The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. \"##ProjectName\").");
|
|
@@ -5402,7 +5402,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5402
5402
|
let x = await Ar(t, o), S = x?.userId, ee = x?.email;
|
|
5403
5403
|
if (h) {
|
|
5404
5404
|
let o = {};
|
|
5405
|
-
r && (o.projectId = await
|
|
5405
|
+
r && (o.projectId = await Fr({
|
|
5406
5406
|
projectId: r,
|
|
5407
5407
|
user: v
|
|
5408
5408
|
})), i && (o.sectionId = i), a && (o.parentId = a);
|
|
@@ -5415,7 +5415,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5415
5415
|
...e
|
|
5416
5416
|
});
|
|
5417
5417
|
return {
|
|
5418
|
-
results: n.map(
|
|
5418
|
+
results: n.map(G),
|
|
5419
5419
|
nextCursor: r
|
|
5420
5420
|
};
|
|
5421
5421
|
},
|
|
@@ -5459,7 +5459,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5459
5459
|
lang: "en",
|
|
5460
5460
|
limit: c,
|
|
5461
5461
|
cursor: m ?? null
|
|
5462
|
-
}), a = r.map(
|
|
5462
|
+
}), a = r.map(G);
|
|
5463
5463
|
return {
|
|
5464
5464
|
textContent: Il({
|
|
5465
5465
|
tasks: a,
|
|
@@ -5490,7 +5490,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5490
5490
|
});
|
|
5491
5491
|
C = jr(C, e);
|
|
5492
5492
|
}
|
|
5493
|
-
let { tasks: w, nextCursor: ne } = await
|
|
5493
|
+
let { tasks: w, nextCursor: ne } = await ei({
|
|
5494
5494
|
client: t,
|
|
5495
5495
|
query: C || "all",
|
|
5496
5496
|
cursor: m,
|
|
@@ -5523,7 +5523,7 @@ function Nl(e) {
|
|
|
5523
5523
|
}
|
|
5524
5524
|
async function Pl(e, t, n) {
|
|
5525
5525
|
if (!(!t?.length || t.length > 1 && n !== "and")) try {
|
|
5526
|
-
let [n, r] = await Promise.all([
|
|
5526
|
+
let [n, r] = await Promise.all([Kr(e), qr(e)]), i = [...n, ...r];
|
|
5527
5527
|
for (let e of t) {
|
|
5528
5528
|
let t = uc(e, i);
|
|
5529
5529
|
if (t) return t;
|
|
@@ -5579,13 +5579,13 @@ function Il({ tasks: e, args: t, nextCursor: n, isContainerSearch: r, assigneeEm
|
|
|
5579
5579
|
t.searchText && (c.push("Try broader search terms"), c.push("Verify spelling and try partial words"), t.responsibleUser || c.push(`Check completed tasks with ${Dl}`));
|
|
5580
5580
|
}
|
|
5581
5581
|
}
|
|
5582
|
-
return
|
|
5582
|
+
return X({
|
|
5583
5583
|
subject: o,
|
|
5584
5584
|
count: e.length,
|
|
5585
5585
|
limit: t.limit,
|
|
5586
5586
|
nextCursor: n ?? void 0,
|
|
5587
5587
|
filterHints: s,
|
|
5588
|
-
previewLines:
|
|
5588
|
+
previewLines: zi(e, Math.min(e.length, t.limit), a),
|
|
5589
5589
|
zeroReasonHints: c
|
|
5590
5590
|
});
|
|
5591
5591
|
}
|
|
@@ -5606,7 +5606,7 @@ var Ll = {
|
|
|
5606
5606
|
templateId: p.string(),
|
|
5607
5607
|
name: p.string(),
|
|
5608
5608
|
description: p.string(),
|
|
5609
|
-
...
|
|
5609
|
+
...Di
|
|
5610
5610
|
})),
|
|
5611
5611
|
nextCursor: p.string().optional().describe("Absent on the last page.")
|
|
5612
5612
|
}, zl = {
|
|
@@ -5650,7 +5650,7 @@ var Ll = {
|
|
|
5650
5650
|
function Bl({ templates: e, query: t, nextCursor: n }) {
|
|
5651
5651
|
let r = t ? ` matching "${t}"` : "";
|
|
5652
5652
|
if (e.length === 0) return `No templates found${r}.`;
|
|
5653
|
-
let i = e.map((e) => `- ${e.name} (id=${e.id}, ${Vl(e)}): ${e.shortDescription}`), a = n ? `\n${
|
|
5653
|
+
let i = e.map((e) => `- ${e.name} (id=${e.id}, ${Vl(e)}): ${e.shortDescription}`), a = n ? `\n${Bi([], n)}` : "";
|
|
5654
5654
|
return `Found ${e.length} template${e.length === 1 ? "" : "s"}${r}:\n${i.join("\n")}${a}`;
|
|
5655
5655
|
}
|
|
5656
5656
|
function Vl(e) {
|
|
@@ -5663,7 +5663,7 @@ var Hl = { projectId: p.string().min(1).optional().describe("Optional project ID
|
|
|
5663
5663
|
parentId: p.string().optional().describe("The parent project ID (for sub-projects, personal projects only)."),
|
|
5664
5664
|
folderId: p.string().optional().describe("The folder ID this project belongs to (workspace projects only)."),
|
|
5665
5665
|
childOrder: p.number().describe("The ordering index among siblings."),
|
|
5666
|
-
sections: p.array(
|
|
5666
|
+
sections: p.array(gi),
|
|
5667
5667
|
children: p.array(Ul).describe("Nested child projects.")
|
|
5668
5668
|
})), Wl = {
|
|
5669
5669
|
type: p.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
|
|
@@ -5681,14 +5681,14 @@ var Hl = { projectId: p.string().min(1).optional().describe("Optional project ID
|
|
|
5681
5681
|
inbox: p.object({
|
|
5682
5682
|
id: p.string().describe("The inbox project ID."),
|
|
5683
5683
|
name: p.string().describe("The inbox project name."),
|
|
5684
|
-
sections: p.array(
|
|
5684
|
+
sections: p.array(gi).describe("Sections in the inbox project.")
|
|
5685
5685
|
}).optional().describe("Inbox information (account overview only)."),
|
|
5686
5686
|
projects: p.array(p.lazy(() => Ul)).optional().describe("List of projects with hierarchy, folders, and ordering (account overview only)."),
|
|
5687
5687
|
project: p.object({
|
|
5688
5688
|
id: p.string().describe("The project ID."),
|
|
5689
5689
|
name: p.string().describe("The project name.")
|
|
5690
5690
|
}).optional().describe("Project details (project overview only)."),
|
|
5691
|
-
sections: p.array(
|
|
5691
|
+
sections: p.array(gi).optional().describe("List of sections (project overview only)."),
|
|
5692
5692
|
tasks: p.array(p.any()).optional().describe("List of tasks (project overview only)."),
|
|
5693
5693
|
stats: p.object({
|
|
5694
5694
|
totalTasks: p.number(),
|
|
@@ -5768,7 +5768,7 @@ function Xl(e, t) {
|
|
|
5768
5768
|
parentId: le(e) ? e.parentId ?? void 0 : void 0,
|
|
5769
5769
|
folderId: de(e) ? e.folderId ?? void 0 : void 0,
|
|
5770
5770
|
childOrder: e.childOrder,
|
|
5771
|
-
sections: (t[e.id] || []).map(
|
|
5771
|
+
sections: (t[e.id] || []).map(_i),
|
|
5772
5772
|
children: e.children.map((e) => Xl(e, t))
|
|
5773
5773
|
};
|
|
5774
5774
|
}
|
|
@@ -5780,7 +5780,7 @@ async function Zl(e, t) {
|
|
|
5780
5780
|
limit: D.TASKS_BATCH_SIZE,
|
|
5781
5781
|
cursor: r ?? void 0
|
|
5782
5782
|
});
|
|
5783
|
-
n = n.concat(i.map(
|
|
5783
|
+
n = n.concat(i.map(G)), r = a ?? void 0;
|
|
5784
5784
|
} while (r);
|
|
5785
5785
|
return n;
|
|
5786
5786
|
}
|
|
@@ -5805,7 +5805,7 @@ async function $l(e) {
|
|
|
5805
5805
|
inbox: n ? {
|
|
5806
5806
|
id: n.id,
|
|
5807
5807
|
name: n.name,
|
|
5808
|
-
sections: (a[n.id] || []).map(
|
|
5808
|
+
sections: (a[n.id] || []).map(_i)
|
|
5809
5809
|
} : void 0,
|
|
5810
5810
|
projects: r.map((e) => Xl(e, a)),
|
|
5811
5811
|
totalProjects: t.length,
|
|
@@ -5815,7 +5815,7 @@ async function $l(e) {
|
|
|
5815
5815
|
};
|
|
5816
5816
|
}
|
|
5817
5817
|
async function eu(e, t) {
|
|
5818
|
-
let n =
|
|
5818
|
+
let n = W(e, t), r = (e) => e.catch(async (e) => {
|
|
5819
5819
|
throw await n, e;
|
|
5820
5820
|
}), [i, a, o] = await Promise.all([
|
|
5821
5821
|
n,
|
|
@@ -5846,7 +5846,7 @@ async function eu(e, t) {
|
|
|
5846
5846
|
id: i.id,
|
|
5847
5847
|
name: i.name
|
|
5848
5848
|
},
|
|
5849
|
-
sections: a.map(
|
|
5849
|
+
sections: a.map(_i),
|
|
5850
5850
|
tasks: o.map((e) => ({
|
|
5851
5851
|
...e,
|
|
5852
5852
|
children: []
|
|
@@ -5870,7 +5870,7 @@ var tu = {
|
|
|
5870
5870
|
idempotentHint: !0
|
|
5871
5871
|
},
|
|
5872
5872
|
async execute(e, t) {
|
|
5873
|
-
let n = await
|
|
5873
|
+
let n = await Fr({
|
|
5874
5874
|
projectId: e.projectId,
|
|
5875
5875
|
client: t
|
|
5876
5876
|
}), r = n ? await eu(t, n) : await $l(t);
|
|
@@ -6191,7 +6191,7 @@ var Su = {
|
|
|
6191
6191
|
idempotentHint: !0
|
|
6192
6192
|
},
|
|
6193
6193
|
async execute(e, t) {
|
|
6194
|
-
let { workspaceIdOrName: n, projectIds: r } = e, i = await
|
|
6194
|
+
let { workspaceIdOrName: n, projectIds: r } = e, i = await sa.resolveWorkspace(t, n), a = (await t.getWorkspaceInsights(i.workspaceId, { projectIds: r })).projectInsights.map((e) => ({
|
|
6195
6195
|
projectId: e.projectId,
|
|
6196
6196
|
health: e.health ? {
|
|
6197
6197
|
status: e.health.status,
|
|
@@ -6224,17 +6224,17 @@ var Su = {
|
|
|
6224
6224
|
}
|
|
6225
6225
|
}, Du = {
|
|
6226
6226
|
projectId: p.string().min(1).describe("The ID of the existing project to import into."),
|
|
6227
|
-
templateId: p.string().regex(
|
|
6227
|
+
templateId: p.string().regex(wa, { error: Ta }).optional().describe("The template to import — either a gallery slug (\"product-launch\"), a personal template ID (\"UT_28Ex...\"), or a full Todoist template URL, which is reduced to the ID automatically. Gallery templates work for anyone; personal templates only for the account that owns them. Find one with find-templates. Not with `csvFileContent`."),
|
|
6228
6228
|
csvFileContent: p.string().min(1).optional().describe("CSV content to import, e.g. from export-project or a file the user shared. Not with `templateId`."),
|
|
6229
6229
|
locale: p.string().optional().describe("Locale for a template's content. Defaults to \"en\".")
|
|
6230
6230
|
}, Ou = {
|
|
6231
|
-
sections: p.array(
|
|
6232
|
-
tasks: p.array(
|
|
6233
|
-
comments: p.array(
|
|
6231
|
+
sections: p.array(gi).describe("Sections created by the import."),
|
|
6232
|
+
tasks: p.array(q).describe("Tasks created by the import."),
|
|
6233
|
+
comments: p.array(xi).describe("Comments created by the import."),
|
|
6234
6234
|
totalCount: p.number().describe("The total number of objects created by the import.")
|
|
6235
6235
|
};
|
|
6236
6236
|
function ku({ projectId: e, source: t, result: n }) {
|
|
6237
|
-
let r = n.sections.map(
|
|
6237
|
+
let r = n.sections.map(_i), i = n.tasks.map(G), a = n.comments.map(Xr), o = n.projects.length + r.length + i.length + a.length;
|
|
6238
6238
|
return {
|
|
6239
6239
|
textContent: Au({
|
|
6240
6240
|
projectId: e,
|
|
@@ -6259,8 +6259,8 @@ function Au({ projectId: e, source: t, counts: n, totalCount: r }) {
|
|
|
6259
6259
|
return r === 0 ? `Imported ${t} into project (id=${e}), but it created nothing.` : `Imported ${t} into project (id=${e}): ${Object.entries(n).filter(([, e]) => e > 0).map(([e, t]) => `${t} ${t === 1 ? e.replace(/s$/, "") : e}`).join(", ")}.`;
|
|
6260
6260
|
}
|
|
6261
6261
|
async function ju(e, { projectId: t, templateId: n, locale: r }, { lookUp: i }) {
|
|
6262
|
-
let [a, o] = await Promise.all([i("project", () =>
|
|
6263
|
-
return `Import ${n ? `the template "${o?.name ??
|
|
6262
|
+
let [a, o] = await Promise.all([i("project", () => W(e, t), { fatal: (e) => e instanceof ot }), n ? i("template", () => e.getTemplate(Ea(n), r ? { locale: r } : void 0)) : void 0]);
|
|
6263
|
+
return `Import ${n ? `the template "${o?.name ?? Ea(n)}"` : "the CSV"} into ${a ? `the project "${a.name}"` : `the project (id=${t})`}? Its sections, tasks and comments are added to what's already there. This can't be undone.`;
|
|
6264
6264
|
}
|
|
6265
6265
|
var Mu = {
|
|
6266
6266
|
name: B.IMPORT_INTO_PROJECT,
|
|
@@ -6298,7 +6298,7 @@ var Mu = {
|
|
|
6298
6298
|
source: "template",
|
|
6299
6299
|
result: await i.importTemplateFromId({
|
|
6300
6300
|
projectId: e,
|
|
6301
|
-
templateId:
|
|
6301
|
+
templateId: Ea(t),
|
|
6302
6302
|
locale: r
|
|
6303
6303
|
}).catch((e) => {
|
|
6304
6304
|
throw s(e);
|
|
@@ -6371,17 +6371,18 @@ var Lu = {
|
|
|
6371
6371
|
structuredContent: n.structuredContent
|
|
6372
6372
|
};
|
|
6373
6373
|
}
|
|
6374
|
-
}, { FIND_TASKS: Ru, FIND_PROJECT_COLLABORATORS: zu, UPDATE_TASKS: Bu } = B, Vu = O.BULK_ACTIONS_PER_OPERATION, Hu =
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6374
|
+
}, { FIND_TASKS: Ru, FIND_PROJECT_COLLABORATORS: zu, UPDATE_TASKS: Bu } = B, Vu = O.BULK_ACTIONS_PER_OPERATION, Hu = p.enum([
|
|
6375
|
+
"assign",
|
|
6376
|
+
"unassign",
|
|
6377
|
+
"reassign"
|
|
6378
|
+
]), Uu = {
|
|
6379
|
+
operation: Hu.describe("The assignment operation to perform."),
|
|
6380
6380
|
taskIds: p.array(p.string()).min(1).max(Vu).describe("The IDs of the tasks to operate on (max 50)."),
|
|
6381
6381
|
responsibleUser: p.string().optional().describe("The user to assign tasks to. Can be \"me\" (assigns to current user), a user ID, name, or email. Required for assign and reassign operations."),
|
|
6382
6382
|
fromAssigneeUser: p.string().optional().describe("For reassign operations: the current assignee to reassign from. Can be user ID, name, or email. Optional - if not provided, reassigns from any current assignee."),
|
|
6383
6383
|
dryRun: p.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
|
|
6384
|
-
},
|
|
6384
|
+
}, Wu = {
|
|
6385
|
+
operation: Hu,
|
|
6385
6386
|
results: p.array(p.object({
|
|
6386
6387
|
taskId: p.string().describe("The ID of the task."),
|
|
6387
6388
|
success: p.boolean().describe("Whether the operation was successful."),
|
|
@@ -6389,17 +6390,15 @@ var Lu = {
|
|
|
6389
6390
|
originalAssigneeId: p.string().optional().describe("The original assignee ID before the operation."),
|
|
6390
6391
|
newAssigneeId: p.string().optional().describe("The new assignee ID after the operation.")
|
|
6391
6392
|
})).describe("Results of the assignment operations."),
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
}).optional().describe("Summary of the operation.")
|
|
6398
|
-
}, Wu = {
|
|
6393
|
+
totalRequested: p.number().int().nonnegative().describe("Requested task count, including fromAssigneeUser skips omitted from results."),
|
|
6394
|
+
successful: p.number().int().nonnegative(),
|
|
6395
|
+
failed: p.number().int().nonnegative(),
|
|
6396
|
+
dryRun: p.boolean()
|
|
6397
|
+
}, Gu = {
|
|
6399
6398
|
name: B.MANAGE_ASSIGNMENTS,
|
|
6400
6399
|
description: `Assign, unassign or reassign up to ${Vu} tasks at once. Assigning notifies the new assignee. Each task is updated independently, so one failure does not undo the others; failures are reported per task. Use dryRun to check the changes first.`,
|
|
6401
|
-
parameters:
|
|
6402
|
-
outputSchema:
|
|
6400
|
+
parameters: Uu,
|
|
6401
|
+
outputSchema: Wu,
|
|
6403
6402
|
annotations: {
|
|
6404
6403
|
readOnlyHint: !1,
|
|
6405
6404
|
destructiveHint: !0,
|
|
@@ -6449,7 +6448,7 @@ var Lu = {
|
|
|
6449
6448
|
newAssigneeId: void 0
|
|
6450
6449
|
}));
|
|
6451
6450
|
return {
|
|
6452
|
-
textContent:
|
|
6451
|
+
textContent: Ku({
|
|
6453
6452
|
operation: n,
|
|
6454
6453
|
results: e,
|
|
6455
6454
|
dryRun: !0
|
|
@@ -6486,7 +6485,7 @@ var Lu = {
|
|
|
6486
6485
|
throw Error(`All ${a.length} unassign operation(s) failed: ${e}`);
|
|
6487
6486
|
}
|
|
6488
6487
|
return {
|
|
6489
|
-
textContent:
|
|
6488
|
+
textContent: Ku({
|
|
6490
6489
|
operation: n,
|
|
6491
6490
|
results: a,
|
|
6492
6491
|
dryRun: !1
|
|
@@ -6561,7 +6560,7 @@ var Lu = {
|
|
|
6561
6560
|
throw Error(`All ${_.length} ${n} operation(s) failed: ${e}`);
|
|
6562
6561
|
}
|
|
6563
6562
|
return {
|
|
6564
|
-
textContent:
|
|
6563
|
+
textContent: Ku({
|
|
6565
6564
|
operation: n,
|
|
6566
6565
|
results: _,
|
|
6567
6566
|
dryRun: o
|
|
@@ -6577,7 +6576,7 @@ var Lu = {
|
|
|
6577
6576
|
};
|
|
6578
6577
|
}
|
|
6579
6578
|
};
|
|
6580
|
-
function
|
|
6579
|
+
function Ku({ operation: e, results: t, dryRun: n }) {
|
|
6581
6580
|
let r = t.filter((e) => e.success), i = t.filter((e) => !e.success), a = n ? "would be" : "were", o = {
|
|
6582
6581
|
assign: "assigned",
|
|
6583
6582
|
unassign: "unassigned",
|
|
@@ -6601,34 +6600,34 @@ function Gu({ operation: e, results: t, dryRun: n }) {
|
|
|
6601
6600
|
return !n && r.length > 0 ? (s += "**Next steps:**\n", s += `• Use ${Ru} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks\n`, s += `• Use ${Bu} for individual assignment changes\n`, i.length > 0 && (s += `• Check failed tasks and use ${zu} to verify collaborator access\n`)) : n ? (s += "**To execute:**\n", s += "• Remove dryRun parameter and run again to execute changes\n", r.length > 0 && (s += `• ${r.length} task${r.length === 1 ? "" : "s"} ready for ${e} operation\n`), i.length > 0 && (s += `• Fix ${i.length} validation error${i.length === 1 ? "" : "s"} before executing\n`)) : r.length === 0 && (s += "**Suggestions:**\n", s += `• Use ${zu} to find valid assignees\n`, s += "• Check task IDs and assignee permissions\n", s += "• Use dryRun=true to validate before executing\n"), s;
|
|
6602
6601
|
}
|
|
6603
6602
|
// src/tools/project-management.ts
|
|
6604
|
-
var { FIND_PROJECTS:
|
|
6603
|
+
var { FIND_PROJECTS: qu } = B, Ju = {
|
|
6605
6604
|
action: p.enum([
|
|
6606
6605
|
"archive",
|
|
6607
6606
|
"unarchive",
|
|
6608
6607
|
"join"
|
|
6609
6608
|
]).describe("The action to perform on the project."),
|
|
6610
6609
|
projectId: p.string().min(1).describe("The ID of the project.")
|
|
6611
|
-
}, Ju = {
|
|
6612
|
-
project: mi.describe("The updated project."),
|
|
6613
|
-
success: p.boolean().describe("Whether the action was successful.")
|
|
6614
6610
|
}, Yu = {
|
|
6611
|
+
project: hi.describe("The updated project."),
|
|
6612
|
+
success: p.boolean().describe("Whether the action was successful.")
|
|
6613
|
+
}, Xu = {
|
|
6615
6614
|
archive: "Archived",
|
|
6616
6615
|
unarchive: "Unarchived",
|
|
6617
6616
|
join: "Joined"
|
|
6618
|
-
},
|
|
6617
|
+
}, Zu = {
|
|
6619
6618
|
name: B.PROJECT_MANAGEMENT,
|
|
6620
|
-
description: `Archive or unarchive a project by its ID, or join a workspace project the user hasn't joined (see ${
|
|
6621
|
-
parameters:
|
|
6622
|
-
outputSchema:
|
|
6619
|
+
description: `Archive or unarchive a project by its ID, or join a workspace project the user hasn't joined (see ${qu} includeUnjoined) when they ask to.`,
|
|
6620
|
+
parameters: Ju,
|
|
6621
|
+
outputSchema: Yu,
|
|
6623
6622
|
annotations: {
|
|
6624
6623
|
readOnlyHint: !1,
|
|
6625
6624
|
destructiveHint: !1,
|
|
6626
6625
|
idempotentHint: !0
|
|
6627
6626
|
},
|
|
6628
6627
|
async execute(e, t) {
|
|
6629
|
-
let n =
|
|
6628
|
+
let n = Yr(await Qu(e, t));
|
|
6630
6629
|
return {
|
|
6631
|
-
textContent: `${
|
|
6630
|
+
textContent: `${Xu[e.action]} project: ${n.name} (id=${n.id})`,
|
|
6632
6631
|
structuredContent: {
|
|
6633
6632
|
project: n,
|
|
6634
6633
|
success: !0
|
|
@@ -6636,12 +6635,12 @@ var { FIND_PROJECTS: Ku } = B, qu = {
|
|
|
6636
6635
|
};
|
|
6637
6636
|
}
|
|
6638
6637
|
};
|
|
6639
|
-
async function
|
|
6638
|
+
async function Qu({ action: e, projectId: t }, n) {
|
|
6640
6639
|
switch (e) {
|
|
6641
6640
|
case "archive": return n.archiveProject(t);
|
|
6642
6641
|
case "unarchive": {
|
|
6643
|
-
let e = await
|
|
6644
|
-
return ue(e) && e.isArchived &&
|
|
6642
|
+
let e = await W(n, t);
|
|
6643
|
+
return ue(e) && e.isArchived && Sa(await xa(n, B.PROJECT_MANAGEMENT), "This project was not unarchived."), n.unarchiveProject(t);
|
|
6645
6644
|
}
|
|
6646
6645
|
case "join": {
|
|
6647
6646
|
let { project: e } = await n.joinProject(t);
|
|
@@ -6650,7 +6649,7 @@ async function Zu({ action: e, projectId: t }, n) {
|
|
|
6650
6649
|
}
|
|
6651
6650
|
}
|
|
6652
6651
|
// src/tools/project-move.ts
|
|
6653
|
-
var
|
|
6652
|
+
var $u = {
|
|
6654
6653
|
action: p.enum(["move-to-workspace", "move-to-personal"]).describe("The action to perform on the project."),
|
|
6655
6654
|
projectId: p.string().min(1).describe("The ID of the project to move."),
|
|
6656
6655
|
workspaceId: p.string().min(1).optional().describe("The target workspace ID. Required when action is move-to-workspace."),
|
|
@@ -6660,14 +6659,14 @@ var Qu = {
|
|
|
6660
6659
|
"team",
|
|
6661
6660
|
"public"
|
|
6662
6661
|
]).optional().describe("Optional access visibility for the project in the workspace (restricted, team, or public).")
|
|
6663
|
-
}, $u = {
|
|
6664
|
-
project: mi.describe("The moved project."),
|
|
6665
|
-
success: p.boolean().describe("Whether the move was successful.")
|
|
6666
6662
|
}, ed = {
|
|
6663
|
+
project: hi.describe("The moved project."),
|
|
6664
|
+
success: p.boolean().describe("Whether the move was successful.")
|
|
6665
|
+
}, td = {
|
|
6667
6666
|
name: B.PROJECT_MOVE,
|
|
6668
6667
|
description: "Move a project between personal and workspace contexts.",
|
|
6669
|
-
parameters:
|
|
6670
|
-
outputSchema:
|
|
6668
|
+
parameters: $u,
|
|
6669
|
+
outputSchema: ed,
|
|
6671
6670
|
annotations: {
|
|
6672
6671
|
readOnlyHint: !1,
|
|
6673
6672
|
destructiveHint: !0,
|
|
@@ -6683,10 +6682,10 @@ var Qu = {
|
|
|
6683
6682
|
};
|
|
6684
6683
|
e.folderId && (r.folderId = e.folderId), e.visibility && (r.access = { visibility: e.visibility }), n = await t.moveProjectToWorkspace(r);
|
|
6685
6684
|
} else {
|
|
6686
|
-
let r = await
|
|
6687
|
-
E(r) && !r.isArchived &&
|
|
6685
|
+
let r = await W(t, e.projectId);
|
|
6686
|
+
E(r) && !r.isArchived && Sa(await xa(t, B.PROJECT_MOVE), "This project was not moved."), n = await t.moveProjectToPersonal({ projectId: e.projectId });
|
|
6688
6687
|
}
|
|
6689
|
-
let r =
|
|
6688
|
+
let r = Yr(n);
|
|
6690
6689
|
return {
|
|
6691
6690
|
textContent: `${e.action === "move-to-workspace" ? "Moved to workspace" : "Moved to personal"}: ${r.name} (id=${r.id})`,
|
|
6692
6691
|
structuredContent: {
|
|
@@ -6697,10 +6696,10 @@ var Qu = {
|
|
|
6697
6696
|
}
|
|
6698
6697
|
};
|
|
6699
6698
|
// src/utils/order-keys.ts
|
|
6700
|
-
function
|
|
6699
|
+
function nd(e, t) {
|
|
6701
6700
|
let n = new Map(e.map((e) => [e.id, e])), r = new Set(t.map((e) => e.id));
|
|
6702
6701
|
for (let e of r) if (!n.has(e)) throw Error(`Sibling id=${e} is not in the list being reordered`);
|
|
6703
|
-
let i = e.every((e) => e.key !== null), a = [...e].sort(i ?
|
|
6702
|
+
let i = e.every((e) => e.key !== null), a = [...e].sort(i ? sd : cd).filter((e) => !r.has(e.id)), o = [...t].sort((e, t) => e.position - t.position), s;
|
|
6704
6703
|
for (let { id: e, position: t } of o) {
|
|
6705
6704
|
let r = n.get(e);
|
|
6706
6705
|
if (!r) continue;
|
|
@@ -6710,20 +6709,20 @@ function td(e, t) {
|
|
|
6710
6709
|
index: o
|
|
6711
6710
|
};
|
|
6712
6711
|
}
|
|
6713
|
-
if (!i || !
|
|
6712
|
+
if (!i || !ad(a, r)) return od(a);
|
|
6714
6713
|
let c = /* @__PURE__ */ new Map(), l = [], u = null;
|
|
6715
|
-
for (let e of a) r.has(e.id) ? l.push(e) : (
|
|
6716
|
-
return
|
|
6714
|
+
for (let e of a) r.has(e.id) ? l.push(e) : (rd(l, u, e.key, c), l = [], u = e.key);
|
|
6715
|
+
return rd(l, u, null, c), c;
|
|
6717
6716
|
}
|
|
6718
|
-
function
|
|
6719
|
-
if (e.length === 0 ||
|
|
6717
|
+
function rd(e, t, n, r) {
|
|
6718
|
+
if (e.length === 0 || id(e, t, n)) return;
|
|
6720
6719
|
let i = ge(t, n, e.length);
|
|
6721
6720
|
e.forEach((e, t) => {
|
|
6722
6721
|
let n = i[t];
|
|
6723
6722
|
n !== void 0 && n !== e.key && r.set(e.id, n);
|
|
6724
6723
|
});
|
|
6725
6724
|
}
|
|
6726
|
-
function
|
|
6725
|
+
function id(e, t, n) {
|
|
6727
6726
|
let r = t;
|
|
6728
6727
|
for (let { key: t } of e) {
|
|
6729
6728
|
if (t === null || r !== null && t <= r) return !1;
|
|
@@ -6731,7 +6730,7 @@ function rd(e, t, n) {
|
|
|
6731
6730
|
}
|
|
6732
6731
|
return n === null || r !== null && r < n;
|
|
6733
6732
|
}
|
|
6734
|
-
function
|
|
6733
|
+
function ad(e, t) {
|
|
6735
6734
|
let n = null;
|
|
6736
6735
|
for (let { id: r, key: i } of e) if (!t.has(r)) {
|
|
6737
6736
|
if (i === null || n !== null && i <= n) return !1;
|
|
@@ -6739,40 +6738,40 @@ function id(e, t) {
|
|
|
6739
6738
|
}
|
|
6740
6739
|
return !0;
|
|
6741
6740
|
}
|
|
6742
|
-
function
|
|
6741
|
+
function od(e) {
|
|
6743
6742
|
let t = ge(null, null, e.length), n = /* @__PURE__ */ new Map();
|
|
6744
6743
|
return e.forEach((e, r) => {
|
|
6745
6744
|
let i = t[r];
|
|
6746
6745
|
i !== void 0 && i !== e.key && n.set(e.id, i);
|
|
6747
6746
|
}), n;
|
|
6748
6747
|
}
|
|
6749
|
-
function
|
|
6748
|
+
function sd(e, t) {
|
|
6750
6749
|
let n = e.key ?? "", r = t.key ?? "";
|
|
6751
6750
|
return n < r ? -1 : +(n > r);
|
|
6752
6751
|
}
|
|
6753
|
-
function
|
|
6752
|
+
function cd(e, t) {
|
|
6754
6753
|
return e.legacyOrder - t.legacyOrder;
|
|
6755
6754
|
}
|
|
6756
6755
|
// src/tools/reorder-objects.ts
|
|
6757
|
-
var
|
|
6756
|
+
var ld = ["project", "section"], ud = p.object({
|
|
6758
6757
|
id: p.string().min(1).describe("The ID of the entity."),
|
|
6759
6758
|
order: p.number().int().min(0).optional().describe("0-based position among its siblings after the reorder: 0 is first, past the end is last. Unlisted siblings keep their relative order."),
|
|
6760
6759
|
parentId: p.string().min(1).optional().describe("Move a personal project under this parent project ID, or \"root\" for the top level. Personal projects only.")
|
|
6761
|
-
}),
|
|
6762
|
-
type: p.enum(
|
|
6763
|
-
items: p.array(
|
|
6764
|
-
},
|
|
6765
|
-
type: p.enum(
|
|
6760
|
+
}), dd = {
|
|
6761
|
+
type: p.enum(ld).describe("\"project\": personal projects among the siblings under their parent, or workspace projects within their folder. \"section\": sections within their project."),
|
|
6762
|
+
items: p.array(ud).min(1).max(O.BULK_ACTIONS_PER_OPERATION).describe("Each item needs order and/or parentId. Moves happen first, so order is a position under the new parent.")
|
|
6763
|
+
}, fd = {
|
|
6764
|
+
type: p.enum(ld).describe("The type of entity that was reordered/moved."),
|
|
6766
6765
|
movedCount: p.number().describe("The number of entities moved to a new parent."),
|
|
6767
6766
|
reorderedCount: p.number().describe("The number of entities reordered."),
|
|
6768
6767
|
affectedIds: p.array(p.string()).describe("The IDs of the entities moved or reordered."),
|
|
6769
|
-
failures: p.array(
|
|
6768
|
+
failures: p.array(J).describe("Entities that could not be moved or reordered, with the reason for each."),
|
|
6770
6769
|
success: p.boolean().describe("Whether every entity was moved and reordered as asked.")
|
|
6771
|
-
},
|
|
6770
|
+
}, pd = {
|
|
6772
6771
|
name: B.REORDER_OBJECTS,
|
|
6773
6772
|
description: "Reorder projects or sections, and optionally move personal projects to a new parent. Personal projects: order places a project among its siblings; parentId moves it (\"root\" for top level). Workspace projects: order places a project within its folder, in the shared default ordering every member sees; needs permission to reorder the workspace. Sections: order places a section within its project.",
|
|
6774
|
-
parameters:
|
|
6775
|
-
outputSchema:
|
|
6773
|
+
parameters: dd,
|
|
6774
|
+
outputSchema: fd,
|
|
6776
6775
|
annotations: {
|
|
6777
6776
|
readOnlyHint: !1,
|
|
6778
6777
|
destructiveHint: !1,
|
|
@@ -6785,11 +6784,11 @@ var cd = ["project", "section"], ld = p.object({
|
|
|
6785
6784
|
if (i.add(e.id), e.order === void 0 && e.parentId === void 0) throw Error(`Item id=${e.id} must have at least one of "order" or "parentId".`);
|
|
6786
6785
|
if (e.parentId !== void 0 && n !== "project") throw Error(`parentId is only supported when type is "project", but type is "${n}".`);
|
|
6787
6786
|
}
|
|
6788
|
-
let a = n === "project" ? await
|
|
6787
|
+
let a = n === "project" ? await md(t, r) : await hd(t, r);
|
|
6789
6788
|
L(B.REORDER_OBJECTS, r.length, a.failures);
|
|
6790
6789
|
let o = n === "project" ? "projects" : "sections", s = r.map((e) => e.id).filter((e) => a.movedIds.has(e) || a.reorderedIds.has(e)), c = [];
|
|
6791
6790
|
return a.movedIds.size > 0 && c.push(`moved ${a.movedIds.size}`), (a.reorderedIds.size > 0 || c.length === 0) && c.push(`reordered ${a.reorderedIds.size}`), {
|
|
6792
|
-
textContent:
|
|
6791
|
+
textContent: Y(s.length > 0 ? `${c.join(" and ")} ${o}: ${s.map((e) => `id=${e}`).join(", ")}` : `${c.join(" and ")} ${o}`, a.failures),
|
|
6793
6792
|
structuredContent: {
|
|
6794
6793
|
type: n,
|
|
6795
6794
|
movedCount: a.movedIds.size,
|
|
@@ -6801,10 +6800,10 @@ var cd = ["project", "section"], ld = p.object({
|
|
|
6801
6800
|
};
|
|
6802
6801
|
}
|
|
6803
6802
|
};
|
|
6804
|
-
async function
|
|
6805
|
-
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [], a = await
|
|
6803
|
+
async function md(e, t) {
|
|
6804
|
+
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [], a = await Sd(e), o = [];
|
|
6806
6805
|
for (let e of t) {
|
|
6807
|
-
let t = a.get(e.id), n = t ?
|
|
6806
|
+
let t = a.get(e.id), n = t ? vd(t, e) : "Project not found, or you do not have access to it.";
|
|
6808
6807
|
n ? i.push({
|
|
6809
6808
|
item: e.id,
|
|
6810
6809
|
error: n
|
|
@@ -6812,7 +6811,7 @@ async function pd(e, t) {
|
|
|
6812
6811
|
}
|
|
6813
6812
|
let s = o.filter((e) => e.parentId !== void 0), c = /* @__PURE__ */ new Set();
|
|
6814
6813
|
if (s.length > 0) {
|
|
6815
|
-
let { outcomes: t } = await
|
|
6814
|
+
let { outcomes: t } = await Q(e, s.map((e) => T("project_move", {
|
|
6816
6815
|
id: e.id,
|
|
6817
6816
|
parentId: e.parentId === "root" ? null : e.parentId
|
|
6818
6817
|
})));
|
|
@@ -6832,7 +6831,7 @@ async function pd(e, t) {
|
|
|
6832
6831
|
failures: i
|
|
6833
6832
|
};
|
|
6834
6833
|
if (n.size > 0) try {
|
|
6835
|
-
a = await
|
|
6834
|
+
a = await Sd(e);
|
|
6836
6835
|
} catch (e) {
|
|
6837
6836
|
let t = P(e);
|
|
6838
6837
|
for (let r of l) i.push({
|
|
@@ -6846,7 +6845,7 @@ async function pd(e, t) {
|
|
|
6846
6845
|
failures: i
|
|
6847
6846
|
};
|
|
6848
6847
|
}
|
|
6849
|
-
let u =
|
|
6848
|
+
let u = gd([...a.values()].filter(yd), bd), d = /* @__PURE__ */ new Map(), f = [];
|
|
6850
6849
|
for (let e of l) {
|
|
6851
6850
|
let t = a.get(e.id);
|
|
6852
6851
|
if (!t) {
|
|
@@ -6857,7 +6856,7 @@ async function pd(e, t) {
|
|
|
6857
6856
|
continue;
|
|
6858
6857
|
}
|
|
6859
6858
|
f.push(e);
|
|
6860
|
-
let n =
|
|
6859
|
+
let n = bd(t), r = d.get(n) ?? [];
|
|
6861
6860
|
r.push({
|
|
6862
6861
|
id: e.id,
|
|
6863
6862
|
position: e.order
|
|
@@ -6865,7 +6864,7 @@ async function pd(e, t) {
|
|
|
6865
6864
|
}
|
|
6866
6865
|
let p = [];
|
|
6867
6866
|
for (let [e, t] of d) {
|
|
6868
|
-
let n =
|
|
6867
|
+
let n = nd((u.get(e) ?? []).map(xd), t);
|
|
6869
6868
|
for (let [e, t] of n) {
|
|
6870
6869
|
let n = a.get(e);
|
|
6871
6870
|
p.push({
|
|
@@ -6880,14 +6879,14 @@ async function pd(e, t) {
|
|
|
6880
6879
|
});
|
|
6881
6880
|
}
|
|
6882
6881
|
}
|
|
6883
|
-
return await
|
|
6882
|
+
return await _d(e, p, f, r, i), {
|
|
6884
6883
|
movedIds: n,
|
|
6885
6884
|
reorderedIds: r,
|
|
6886
6885
|
failures: i
|
|
6887
6886
|
};
|
|
6888
6887
|
}
|
|
6889
|
-
async function
|
|
6890
|
-
let n = /* @__PURE__ */ new Set(), r = [], i = await
|
|
6888
|
+
async function hd(e, t) {
|
|
6889
|
+
let n = /* @__PURE__ */ new Set(), r = [], i = await Cd(e), a = gd([...i.values()].filter((e) => !e.isDeleted && !e.isArchived), (e) => e.projectId), o = t.filter((e) => e.order !== void 0), s = /* @__PURE__ */ new Map(), c = [];
|
|
6891
6890
|
for (let e of o) {
|
|
6892
6891
|
let t = i.get(e.id);
|
|
6893
6892
|
if (!t || t.isDeleted) {
|
|
@@ -6913,7 +6912,7 @@ async function md(e, t) {
|
|
|
6913
6912
|
}
|
|
6914
6913
|
let l = [];
|
|
6915
6914
|
for (let [e, t] of s) {
|
|
6916
|
-
let n =
|
|
6915
|
+
let n = nd((a.get(e) ?? []).map((e) => ({
|
|
6917
6916
|
id: e.id,
|
|
6918
6917
|
key: e.orderKey ?? null,
|
|
6919
6918
|
legacyOrder: e.sectionOrder
|
|
@@ -6926,13 +6925,13 @@ async function md(e, t) {
|
|
|
6926
6925
|
})
|
|
6927
6926
|
});
|
|
6928
6927
|
}
|
|
6929
|
-
return await
|
|
6928
|
+
return await _d(e, l, c, n, r), {
|
|
6930
6929
|
movedIds: /* @__PURE__ */ new Set(),
|
|
6931
6930
|
reorderedIds: n,
|
|
6932
6931
|
failures: r
|
|
6933
6932
|
};
|
|
6934
6933
|
}
|
|
6935
|
-
function
|
|
6934
|
+
function gd(e, t) {
|
|
6936
6935
|
let n = /* @__PURE__ */ new Map();
|
|
6937
6936
|
for (let r of e) {
|
|
6938
6937
|
let e = t(r), i = n.get(e) ?? [];
|
|
@@ -6940,10 +6939,10 @@ function hd(e, t) {
|
|
|
6940
6939
|
}
|
|
6941
6940
|
return n;
|
|
6942
6941
|
}
|
|
6943
|
-
async function
|
|
6942
|
+
async function _d(e, t, n, r, i) {
|
|
6944
6943
|
let a = /* @__PURE__ */ new Set();
|
|
6945
6944
|
if (t.length > 0) {
|
|
6946
|
-
let { outcomes: n } = await
|
|
6945
|
+
let { outcomes: n } = await Q(e, t.map((e) => e.command));
|
|
6947
6946
|
n.forEach((e, n) => {
|
|
6948
6947
|
let r = t[n]?.id;
|
|
6949
6948
|
r !== void 0 && e.status !== "fulfilled" && (a.add(r), i.push({
|
|
@@ -6955,19 +6954,19 @@ async function gd(e, t, n, r, i) {
|
|
|
6955
6954
|
}
|
|
6956
6955
|
for (let { id: e } of n) a.has(e) || r.add(e);
|
|
6957
6956
|
}
|
|
6958
|
-
function
|
|
6957
|
+
function vd(e, t) {
|
|
6959
6958
|
if (e.isDeleted) return "Project not found, or you do not have access to it.";
|
|
6960
6959
|
if (e.isArchived) return "Archived projects cannot be reordered or moved.";
|
|
6961
6960
|
if (!E(e) && e.inboxProject) return "The Inbox always comes first and cannot be reordered or moved.";
|
|
6962
6961
|
if (E(e) && t.parentId !== void 0) return "parentId is only supported for personal projects. Workspace projects are ordered within their folder; omit parentId to reorder it there.";
|
|
6963
6962
|
}
|
|
6964
|
-
function
|
|
6963
|
+
function yd(e) {
|
|
6965
6964
|
return e.isDeleted || e.isArchived ? !1 : E(e) || !e.inboxProject;
|
|
6966
6965
|
}
|
|
6967
|
-
function
|
|
6966
|
+
function bd(e) {
|
|
6968
6967
|
return E(e) ? `workspace:${e.workspaceId}:${e.folderId ?? "root"}` : `personal:${e.parentId ?? "root"}`;
|
|
6969
6968
|
}
|
|
6970
|
-
function
|
|
6969
|
+
function xd(e) {
|
|
6971
6970
|
return E(e) ? {
|
|
6972
6971
|
id: e.id,
|
|
6973
6972
|
key: e.defaultOrderKey ?? null,
|
|
@@ -6978,14 +6977,14 @@ function bd(e) {
|
|
|
6978
6977
|
legacyOrder: e.childOrder
|
|
6979
6978
|
};
|
|
6980
6979
|
}
|
|
6981
|
-
async function
|
|
6980
|
+
async function Sd(e) {
|
|
6982
6981
|
let t = await R(() => e.sync({
|
|
6983
6982
|
resourceTypes: ["projects"],
|
|
6984
6983
|
syncToken: "*"
|
|
6985
6984
|
}));
|
|
6986
6985
|
return new Map((t.projects ?? []).map((e) => [e.id, e]));
|
|
6987
6986
|
}
|
|
6988
|
-
async function
|
|
6987
|
+
async function Cd(e) {
|
|
6989
6988
|
let t = await R(() => e.sync({
|
|
6990
6989
|
resourceTypes: ["sections"],
|
|
6991
6990
|
syncToken: "*"
|
|
@@ -6993,20 +6992,20 @@ async function Sd(e) {
|
|
|
6993
6992
|
return new Map((t.sections ?? []).map((e) => [e.id, e]));
|
|
6994
6993
|
}
|
|
6995
6994
|
// src/tools/reschedule-tasks.ts
|
|
6996
|
-
var
|
|
6995
|
+
var wd = p.object({
|
|
6997
6996
|
id: p.string().min(1).describe("The ID of the task to reschedule."),
|
|
6998
6997
|
date: p.string().min(1).describe("The new date for the task. Use YYYY-MM-DD for date-only, or YYYY-MM-DDTHH:MM:SS for datetime. If date-only is provided and the task already has a specific time, the existing time is preserved."),
|
|
6999
6998
|
duration: p.string().optional().describe("Optional new duration, e.g. for time-blocking: \"15m\", \"1h\", \"2h30m\".")
|
|
7000
|
-
}),
|
|
7001
|
-
tasks: p.array(
|
|
6999
|
+
}), Td = { tasks: p.array(wd).min(1).max(O.BULK_ACTIONS_PER_OPERATION).describe("The tasks to reschedule with their new dates.") }, Ed = {
|
|
7000
|
+
tasks: p.array(q).describe("The rescheduled tasks."),
|
|
7002
7001
|
totalCount: p.number().describe("The total number of tasks rescheduled."),
|
|
7003
7002
|
rescheduledTaskIds: p.array(p.string()).describe("The IDs of the rescheduled tasks."),
|
|
7004
|
-
failures: p.array(
|
|
7005
|
-
},
|
|
7003
|
+
failures: p.array(J).describe("Tasks that could not be rescheduled, with reasons.")
|
|
7004
|
+
}, Dd = {
|
|
7006
7005
|
name: B.RESCHEDULE_TASKS,
|
|
7007
7006
|
description: "Reschedule tasks to new dates while preserving recurring schedules. Unlike update-tasks (which replaces the entire due string and can wipe recurrence), this tool changes only the date (and duration, if given), keeping recurrence patterns intact. Use this when moving recurring tasks to a different date or time without altering their repeat pattern. Without a due date, the deadline moves.",
|
|
7008
|
-
parameters:
|
|
7009
|
-
outputSchema:
|
|
7007
|
+
parameters: Td,
|
|
7008
|
+
outputSchema: Ed,
|
|
7010
7009
|
annotations: {
|
|
7011
7010
|
readOnlyHint: !1,
|
|
7012
7011
|
destructiveHint: !0,
|
|
@@ -7017,7 +7016,7 @@ var Cd = p.object({
|
|
|
7017
7016
|
i.push(...a.failures);
|
|
7018
7017
|
let o = [];
|
|
7019
7018
|
for (let { item: e, index: t, value: n } of a.succeeded) {
|
|
7020
|
-
let i =
|
|
7019
|
+
let i = Od(e.date, n);
|
|
7021
7020
|
i && o.push({
|
|
7022
7021
|
id: e.id,
|
|
7023
7022
|
command: T("item_update", {
|
|
@@ -7029,14 +7028,14 @@ var Cd = p.object({
|
|
|
7029
7028
|
}
|
|
7030
7029
|
let s = [];
|
|
7031
7030
|
if (o.length > 0) {
|
|
7032
|
-
let { outcomes: e } = await
|
|
7031
|
+
let { outcomes: e } = await Q(t, o.map(({ command: e }) => e)), n = I(o, e, ({ id: e }) => e);
|
|
7033
7032
|
s.push(...n.succeeded.map(({ item: e }) => e.id)), i.push(...n.failures);
|
|
7034
7033
|
}
|
|
7035
7034
|
L(B.RESCHEDULE_TASKS, n.length, i);
|
|
7036
7035
|
let c = [], l = [], u;
|
|
7037
7036
|
if (s.length > 0) {
|
|
7038
7037
|
let e = await Promise.allSettled(s.map((e) => R(() => t.getTask(e))));
|
|
7039
|
-
for (let [t, n] of e.entries()) n.status === "fulfilled" ? c.push(
|
|
7038
|
+
for (let [t, n] of e.entries()) n.status === "fulfilled" ? c.push(G(n.value)) : (l.push(s[t] ?? `Task ${t + 1}`), u ??= P(n.reason));
|
|
7040
7039
|
u && console.error(`${B.RESCHEDULE_TASKS}: read-back failed`, {
|
|
7041
7040
|
updated: s.length,
|
|
7042
7041
|
unread: l.length,
|
|
@@ -7044,7 +7043,7 @@ var Cd = p.object({
|
|
|
7044
7043
|
});
|
|
7045
7044
|
}
|
|
7046
7045
|
return {
|
|
7047
|
-
textContent:
|
|
7046
|
+
textContent: Y(u ? `Rescheduled ${s.length} task${s.length === 1 ? "" : "s"}: ${s.join(", ")}\nCould not read back ${l.join(", ")}: ${u}` : Pi("Rescheduled", c, { showDetails: c.length <= 5 }), i),
|
|
7048
7047
|
structuredContent: {
|
|
7049
7048
|
tasks: c,
|
|
7050
7049
|
totalCount: s.length,
|
|
@@ -7054,9 +7053,9 @@ var Cd = p.object({
|
|
|
7054
7053
|
};
|
|
7055
7054
|
}
|
|
7056
7055
|
};
|
|
7057
|
-
function
|
|
7056
|
+
function Od(e, t) {
|
|
7058
7057
|
if (t.due) return { due: {
|
|
7059
|
-
date:
|
|
7058
|
+
date: kd(e, t.due),
|
|
7060
7059
|
...t.due.isRecurring && { string: t.due.string },
|
|
7061
7060
|
isRecurring: t.due.isRecurring,
|
|
7062
7061
|
timezone: t.due.timezone ?? void 0,
|
|
@@ -7064,28 +7063,28 @@ function Dd(e, t) {
|
|
|
7064
7063
|
} };
|
|
7065
7064
|
if (t.deadline) return { deadline: { date: e.slice(0, 10) } };
|
|
7066
7065
|
}
|
|
7067
|
-
function
|
|
7066
|
+
function kd(e, t) {
|
|
7068
7067
|
let n = /^\d{4}-\d{2}-\d{2}$/.test(e), r = t.date.substring(10);
|
|
7069
7068
|
if (n && r) {
|
|
7070
7069
|
if (r.endsWith("Z") && t.timezone) {
|
|
7071
|
-
let n =
|
|
7070
|
+
let n = Ad(e, t.date, t.timezone);
|
|
7072
7071
|
if (n) return n;
|
|
7073
7072
|
}
|
|
7074
7073
|
return e + r;
|
|
7075
7074
|
}
|
|
7076
7075
|
return e;
|
|
7077
7076
|
}
|
|
7078
|
-
function
|
|
7079
|
-
let r = Date.parse(t), i =
|
|
7077
|
+
function Ad(e, t, n) {
|
|
7078
|
+
let r = Date.parse(t), i = Md(n, r);
|
|
7080
7079
|
if (i === void 0) return;
|
|
7081
7080
|
let a = new Date(r + i * 6e4).toISOString().slice(11, 19), o = Date.parse(`${e}T${a}Z`);
|
|
7082
7081
|
if (Number.isNaN(o) || new Date(o).toISOString().slice(0, 10) !== e) return;
|
|
7083
|
-
let s =
|
|
7082
|
+
let s = Md(n, o - i * 6e4) ?? i;
|
|
7084
7083
|
return `${(/* @__PURE__ */ new Date(o - s * 6e4)).toISOString().slice(0, 19)}Z`;
|
|
7085
7084
|
}
|
|
7086
|
-
var
|
|
7087
|
-
function
|
|
7088
|
-
let n =
|
|
7085
|
+
var jd = /^GMT ([+-])(\d{1,2}):(\d{2})$/;
|
|
7086
|
+
function Md(e, t) {
|
|
7087
|
+
let n = jd.exec(e);
|
|
7089
7088
|
if (n) {
|
|
7090
7089
|
let [, e, t, r] = n;
|
|
7091
7090
|
return An(`${e}${t?.padStart(2, "0")}:${r}`);
|
|
@@ -7093,30 +7092,30 @@ function jd(e, t) {
|
|
|
7093
7092
|
return In(t, e);
|
|
7094
7093
|
}
|
|
7095
7094
|
// src/tools/search.ts
|
|
7096
|
-
var
|
|
7095
|
+
var Nd = { query: p.string().min(1).describe("The search query string to find tasks and projects.") }, Pd = {
|
|
7097
7096
|
results: p.array(p.object({
|
|
7098
7097
|
id: p.string().describe("The ID of the result."),
|
|
7099
7098
|
title: p.string().describe("The title of the result."),
|
|
7100
7099
|
url: p.string().describe("The URL of the result.")
|
|
7101
7100
|
})).describe("The search results."),
|
|
7102
7101
|
totalCount: p.number().describe("Total number of results found.")
|
|
7103
|
-
},
|
|
7102
|
+
}, Fd = {
|
|
7104
7103
|
name: B.SEARCH,
|
|
7105
7104
|
description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
|
|
7106
|
-
parameters:
|
|
7107
|
-
outputSchema:
|
|
7105
|
+
parameters: Nd,
|
|
7106
|
+
outputSchema: Pd,
|
|
7108
7107
|
annotations: {
|
|
7109
7108
|
readOnlyHint: !0,
|
|
7110
7109
|
destructiveHint: !1,
|
|
7111
7110
|
idempotentHint: !0
|
|
7112
7111
|
},
|
|
7113
7112
|
async execute(e, t) {
|
|
7114
|
-
let { query: n } = e, [r, i] = await Promise.all([
|
|
7113
|
+
let { query: n } = e, [r, i] = await Promise.all([ei({
|
|
7115
7114
|
client: t,
|
|
7116
7115
|
query: `search: ${ae(n)}`,
|
|
7117
7116
|
limit: D.TASKS_MAX,
|
|
7118
7117
|
cursor: void 0
|
|
7119
|
-
}),
|
|
7118
|
+
}), Lr(t, n)]), a = [];
|
|
7120
7119
|
for (let e of r.tasks) a.push({
|
|
7121
7120
|
id: `task:${e.id}`,
|
|
7122
7121
|
title: e.content,
|
|
@@ -7135,20 +7134,20 @@ var Md = { query: p.string().min(1).describe("The search query string to find ta
|
|
|
7135
7134
|
}
|
|
7136
7135
|
};
|
|
7137
7136
|
}
|
|
7138
|
-
},
|
|
7137
|
+
}, Id = {
|
|
7139
7138
|
message: p.string().trim().min(1).max(80).optional().describe("Omit for an emoji-only status."),
|
|
7140
7139
|
emoji: p.string().trim().min(1).optional().describe("A Unicode emoji, such as 🏝️."),
|
|
7141
7140
|
activeUntil: p.string().trim().optional().describe("When it ends: a future ISO 8601 timestamp with Z or an offset, e.g. 2026-11-10T00:00:00+00:00. Omit for no end."),
|
|
7142
7141
|
pauseNotifications: p.boolean().optional().describe("Hold back Comms notifications while active. They are not sent later."),
|
|
7143
7142
|
pauseActivity: p.boolean().optional().describe("Pause Karma and streaks while active."),
|
|
7144
7143
|
clear: p.boolean().optional().describe("Remove the status. Use alone.")
|
|
7145
|
-
},
|
|
7146
|
-
function
|
|
7144
|
+
}, Ld = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|([+-])(\d{2}):(\d{2}))$/i, Rd = -720, zd = 840;
|
|
7145
|
+
function Bd(e) {
|
|
7147
7146
|
return /* @__PURE__ */ Error(`activeUntil must be an ISO 8601 timestamp with Z or an offset, such as "2026-11-10T00:00:00+00:00". Got "${e}".`);
|
|
7148
7147
|
}
|
|
7149
|
-
function
|
|
7150
|
-
let n =
|
|
7151
|
-
if (!n) throw
|
|
7148
|
+
function Vd(e, t) {
|
|
7149
|
+
let n = Ld.exec(e);
|
|
7150
|
+
if (!n) throw Bd(e);
|
|
7152
7151
|
let [, r, i, a, o, s, c = "0", l = ""] = n, [u, d, f, p, m, h] = [
|
|
7153
7152
|
r,
|
|
7154
7153
|
i,
|
|
@@ -7159,14 +7158,14 @@ function Bd(e, t) {
|
|
|
7159
7158
|
].map(Number), g = /* @__PURE__ */ new Date(0);
|
|
7160
7159
|
g.setUTCFullYear(u, d - 1, f), g.setUTCHours(p, m, h);
|
|
7161
7160
|
let _ = g.getUTCFullYear() === u && g.getUTCMonth() === d - 1 && g.getUTCDate() === f && g.getUTCHours() === p && g.getUTCMinutes() === m && g.getUTCSeconds() === h, v = l.toUpperCase() === "Z" ? 0 : An(l);
|
|
7162
|
-
if (!_ || v <
|
|
7161
|
+
if (!_ || v < Rd || v > zd) throw Bd(e);
|
|
7163
7162
|
let y = new Date(e);
|
|
7164
|
-
if (Number.isNaN(y.getTime())) throw
|
|
7163
|
+
if (Number.isNaN(y.getTime())) throw Bd(e);
|
|
7165
7164
|
if (y.getTime() <= t.getTime()) throw Error(`activeUntil must be in the future. Got "${e}".`);
|
|
7166
7165
|
return y.toISOString();
|
|
7167
7166
|
}
|
|
7168
|
-
var
|
|
7169
|
-
function
|
|
7167
|
+
var Hd = { scope: { mode: "all" } };
|
|
7168
|
+
function Ud(e, t) {
|
|
7170
7169
|
let { clear: n, message: r, emoji: i, activeUntil: a, pauseNotifications: o, pauseActivity: s } = e;
|
|
7171
7170
|
if (n) {
|
|
7172
7171
|
if (r !== void 0 || i !== void 0 || a !== void 0 || o === !0 || s === !0) throw Error("clear removes the status, so it cannot be combined with other fields.");
|
|
@@ -7176,24 +7175,24 @@ function Hd(e, t) {
|
|
|
7176
7175
|
return {
|
|
7177
7176
|
message: r ?? null,
|
|
7178
7177
|
emoji: i ?? null,
|
|
7179
|
-
activeUntil: a === void 0 ? null :
|
|
7178
|
+
activeUntil: a === void 0 ? null : Vd(a, t),
|
|
7180
7179
|
effects: o || s ? {
|
|
7181
|
-
pauseNotifications: o ?
|
|
7182
|
-
pauseActivity: s ?
|
|
7180
|
+
pauseNotifications: o ? Hd : null,
|
|
7181
|
+
pauseActivity: s ? Hd : null
|
|
7183
7182
|
} : null
|
|
7184
7183
|
};
|
|
7185
7184
|
}
|
|
7186
|
-
function
|
|
7185
|
+
function Wd(e) {
|
|
7187
7186
|
return e ? e.replace(/\uFE0F/g, "") : null;
|
|
7188
7187
|
}
|
|
7189
|
-
function
|
|
7188
|
+
function Gd(e, t) {
|
|
7190
7189
|
let n = e.activeUntil ? new Date(e.activeUntil).getTime() : null, r = t.activeUntil ? new Date(t.activeUntil).getTime() : null;
|
|
7191
|
-
return (e.message ?? null) === (t.message ?? null) &&
|
|
7190
|
+
return (e.message ?? null) === (t.message ?? null) && Wd(e.emoji) === Wd(t.emoji) && n === r && !!e.effects?.pauseNotifications == !!t.effects?.pauseNotifications && !!e.effects?.pauseActivity == !!t.effects?.pauseActivity;
|
|
7192
7191
|
}
|
|
7193
|
-
var
|
|
7192
|
+
var Kd = {
|
|
7194
7193
|
name: B.SET_USER_STATUS,
|
|
7195
7194
|
description: "Set or clear the user's status, shown next to their name in Todoist and Comms. It needs a message, an emoji or both. Replaces the whole status: any field omitted is removed, not kept. Use clear to remove the status.",
|
|
7196
|
-
parameters:
|
|
7195
|
+
parameters: Id,
|
|
7197
7196
|
outputSchema: _u,
|
|
7198
7197
|
annotations: {
|
|
7199
7198
|
readOnlyHint: !1,
|
|
@@ -7202,7 +7201,7 @@ var Gd = {
|
|
|
7202
7201
|
openWorldHint: !0
|
|
7203
7202
|
},
|
|
7204
7203
|
async execute(e, t) {
|
|
7205
|
-
let n =
|
|
7204
|
+
let n = Ud(e, /* @__PURE__ */ new Date()), { outcomes: [r] } = await Q(t, [T("user_update", { status: n })]);
|
|
7206
7205
|
if (r?.status !== "fulfilled") throw r?.reason ?? /* @__PURE__ */ Error("Todoist did not report whether the status was applied.");
|
|
7207
7206
|
let i = await yu(t).catch(() => {
|
|
7208
7207
|
throw Error(`The status was written, but reading it back failed, so it is unconfirmed. Use ${B.GET_USER_STATUS} to check it.`);
|
|
@@ -7212,29 +7211,29 @@ var Gd = {
|
|
|
7212
7211
|
return xu(null, "Status cleared");
|
|
7213
7212
|
}
|
|
7214
7213
|
if (!i) throw Error("Todoist accepted the status but reports no active status, so it may have expired already.");
|
|
7215
|
-
if (!
|
|
7214
|
+
if (!Gd(i, n)) throw Error(`Todoist accepted the status but reports a different one. Another app may have changed it at the same moment; use ${B.GET_USER_STATUS} to see it.`);
|
|
7216
7215
|
return xu(i, "Status set");
|
|
7217
7216
|
}
|
|
7218
|
-
},
|
|
7217
|
+
}, qd = { ids: p.array(p.string().min(1)).min(1).max(O.BULK_ACTIONS_PER_OPERATION).describe("The IDs of the tasks to uncomplete.") }, Jd = {
|
|
7219
7218
|
uncompleted: p.array(p.string()).describe("The IDs of successfully uncompleted tasks."),
|
|
7220
|
-
failures: p.array(
|
|
7219
|
+
failures: p.array(J).describe("Failed task uncompletion with error details."),
|
|
7221
7220
|
totalRequested: p.number().describe("The total number of tasks requested to uncomplete."),
|
|
7222
7221
|
successCount: p.number().describe("The number of successfully uncompleted tasks."),
|
|
7223
7222
|
failureCount: p.number().describe("The number of failed task uncompletions.")
|
|
7224
|
-
},
|
|
7223
|
+
}, Yd = {
|
|
7225
7224
|
name: B.UNCOMPLETE_TASKS,
|
|
7226
7225
|
description: "Uncomplete (reopen) one or more completed tasks by their IDs.",
|
|
7227
|
-
parameters:
|
|
7228
|
-
outputSchema:
|
|
7226
|
+
parameters: qd,
|
|
7227
|
+
outputSchema: Jd,
|
|
7229
7228
|
annotations: {
|
|
7230
7229
|
readOnlyHint: !1,
|
|
7231
7230
|
destructiveHint: !1,
|
|
7232
7231
|
idempotentHint: !1
|
|
7233
7232
|
},
|
|
7234
7233
|
async execute(e, t) {
|
|
7235
|
-
let n = await
|
|
7234
|
+
let n = await Xd(t, e.ids), { succeeded: r, failures: i } = I(e.ids, n, (e) => e), a = r.map(({ item: e }) => e);
|
|
7236
7235
|
return L(B.UNCOMPLETE_TASKS, e.ids.length, i), {
|
|
7237
|
-
textContent:
|
|
7236
|
+
textContent: Zd({
|
|
7238
7237
|
uncompleted: a,
|
|
7239
7238
|
failures: i,
|
|
7240
7239
|
args: e
|
|
@@ -7249,15 +7248,15 @@ var Gd = {
|
|
|
7249
7248
|
};
|
|
7250
7249
|
}
|
|
7251
7250
|
};
|
|
7252
|
-
async function
|
|
7253
|
-
let n = [...new Set(t)], { outcomes: r } = await
|
|
7251
|
+
async function Xd(e, t) {
|
|
7252
|
+
let n = [...new Set(t)], { outcomes: r } = await Q(e, n.map((e) => T("item_uncomplete", { id: e })), { limit: Lt(e) }), i = new Map(n.map((e, t) => [e, r[t]]));
|
|
7254
7253
|
return t.map((e) => i.get(e) ?? {
|
|
7255
7254
|
status: "rejected",
|
|
7256
7255
|
reason: /* @__PURE__ */ Error("Todoist did not report whether this task was reopened")
|
|
7257
7256
|
});
|
|
7258
7257
|
}
|
|
7259
|
-
function
|
|
7260
|
-
return
|
|
7258
|
+
function Zd({ uncompleted: e, failures: t, args: n }) {
|
|
7259
|
+
return Fi({
|
|
7261
7260
|
action: "Uncompleted tasks",
|
|
7262
7261
|
success: e.length,
|
|
7263
7262
|
total: n.ids.length,
|
|
@@ -7267,32 +7266,32 @@ function Xd({ uncompleted: e, failures: t, args: n }) {
|
|
|
7267
7266
|
});
|
|
7268
7267
|
}
|
|
7269
7268
|
// src/tools/update-comments.ts
|
|
7270
|
-
var
|
|
7269
|
+
var Qd = p.object({
|
|
7271
7270
|
id: p.string().min(1).describe("The ID of the comment to update."),
|
|
7272
7271
|
content: p.string().min(1).describe("The new content for the comment.")
|
|
7273
|
-
}),
|
|
7274
|
-
comments: p.array(
|
|
7272
|
+
}), $d = { comments: p.array(Qd).min(1).max(O.ITEMS_PER_OPERATION).describe("The comments to update.") }, ef = {
|
|
7273
|
+
comments: p.array(xi).describe("The updated comments."),
|
|
7275
7274
|
totalCount: p.number().describe("The total number of comments updated."),
|
|
7276
7275
|
updatedCommentIds: p.array(p.string()).describe("The IDs of the updated comments."),
|
|
7277
|
-
failures: p.array(
|
|
7276
|
+
failures: p.array(J).describe("Comments that could not be updated, with the reason for each."),
|
|
7278
7277
|
appliedOperations: p.object({
|
|
7279
7278
|
updateCount: p.number().describe("The number of comments updated."),
|
|
7280
7279
|
failureCount: p.number()
|
|
7281
7280
|
}).describe("Summary of operations performed.")
|
|
7282
|
-
},
|
|
7281
|
+
}, tf = {
|
|
7283
7282
|
name: B.UPDATE_COMMENTS,
|
|
7284
7283
|
description: "Update multiple existing comments with new content.",
|
|
7285
|
-
parameters:
|
|
7286
|
-
outputSchema:
|
|
7284
|
+
parameters: $d,
|
|
7285
|
+
outputSchema: ef,
|
|
7287
7286
|
annotations: {
|
|
7288
7287
|
readOnlyHint: !1,
|
|
7289
7288
|
destructiveHint: !0,
|
|
7290
7289
|
idempotentHint: !1
|
|
7291
7290
|
},
|
|
7292
7291
|
async execute(e, t) {
|
|
7293
|
-
let { comments: n } = e, { succeeded: r, failures: i } = I(n, await Promise.allSettled(n.map((e) => R(() => t.updateComment(e.id, { content: e.content })))), (e) => e.id), a = r.map(({ value: e }) =>
|
|
7292
|
+
let { comments: n } = e, { succeeded: r, failures: i } = I(n, await Promise.allSettled(n.map((e) => R(() => t.updateComment(e.id, { content: e.content })))), (e) => e.id), a = r.map(({ value: e }) => Xr(e));
|
|
7294
7293
|
return L(B.UPDATE_COMMENTS, n.length, i), {
|
|
7295
|
-
textContent:
|
|
7294
|
+
textContent: Y(nf({ comments: a }), i),
|
|
7296
7295
|
structuredContent: {
|
|
7297
7296
|
comments: a,
|
|
7298
7297
|
totalCount: a.length,
|
|
@@ -7306,7 +7305,7 @@ var Zd = p.object({
|
|
|
7306
7305
|
};
|
|
7307
7306
|
}
|
|
7308
7307
|
};
|
|
7309
|
-
function
|
|
7308
|
+
function nf({ comments: e }) {
|
|
7310
7309
|
let t = e.filter((e) => e.taskId).length, n = e.filter((e) => e.projectId).length, r = [];
|
|
7311
7310
|
if (t > 0) {
|
|
7312
7311
|
let e = t > 1 ? "comments" : "comment";
|
|
@@ -7319,28 +7318,28 @@ function tf({ comments: e }) {
|
|
|
7319
7318
|
return r.length > 0 ? `Updated ${r.join(" and ")}` : "No comments updated";
|
|
7320
7319
|
}
|
|
7321
7320
|
// src/tools/update-filters.ts
|
|
7322
|
-
var
|
|
7321
|
+
var rf = p.object({
|
|
7323
7322
|
id: p.string().min(1).describe("The ID of the filter to update."),
|
|
7324
7323
|
name: p.string().min(1).optional().describe("The new name of the filter."),
|
|
7325
7324
|
query: p.string().min(1).optional().describe("The new filter query string. Examples: \"today & p1\", \"#Work & overdue\", \"@email & today\"."),
|
|
7326
7325
|
description: p.preprocess((e) => e === null ? "remove" : e, p.string().describe("A markdown description explaining what the filter is for. Use \"remove\" to clear the description; omit the field to leave it unchanged.")).optional(),
|
|
7327
|
-
color:
|
|
7326
|
+
color: pi,
|
|
7328
7327
|
isFavorite: p.boolean().optional().describe("Whether to mark the filter as a favorite.")
|
|
7329
|
-
}),
|
|
7330
|
-
filters: p.array(
|
|
7328
|
+
}), af = { filters: p.array(rf).min(1).max(O.ITEMS_PER_OPERATION).describe("The filters to update.") }, of = {
|
|
7329
|
+
filters: p.array(Zi).describe("The updated filters, as read back after the update. Empty if they could not be read back; updatedFilterIds still lists what was updated."),
|
|
7331
7330
|
totalCount: p.number().describe("The total number of filters updated."),
|
|
7332
7331
|
updatedFilterIds: p.array(p.string()).describe("The IDs of the updated filters."),
|
|
7333
|
-
failures: p.array(
|
|
7332
|
+
failures: p.array(J).describe("Filters that could not be updated, with the reason for each."),
|
|
7334
7333
|
appliedOperations: p.object({
|
|
7335
7334
|
updateCount: p.number().describe("The number of filters actually updated."),
|
|
7336
7335
|
skippedCount: p.number().describe("The number of filters skipped (no changes)."),
|
|
7337
7336
|
failureCount: p.number()
|
|
7338
7337
|
}).describe("Summary of operations performed.")
|
|
7339
|
-
},
|
|
7338
|
+
}, sf = {
|
|
7340
7339
|
name: B.UPDATE_FILTERS,
|
|
7341
7340
|
description: "Update one or more existing personal filters with new values.",
|
|
7342
|
-
parameters:
|
|
7343
|
-
outputSchema:
|
|
7341
|
+
parameters: af,
|
|
7342
|
+
outputSchema: of,
|
|
7344
7343
|
annotations: {
|
|
7345
7344
|
readOnlyHint: !1,
|
|
7346
7345
|
destructiveHint: !0,
|
|
@@ -7348,7 +7347,7 @@ var nf = p.object({
|
|
|
7348
7347
|
},
|
|
7349
7348
|
async execute(e, t) {
|
|
7350
7349
|
let { filters: n } = e, r = [], i = n.map((e) => {
|
|
7351
|
-
let t =
|
|
7350
|
+
let t = uf(e);
|
|
7352
7351
|
return t === null ? (r.push(e), {
|
|
7353
7352
|
kind: "updated",
|
|
7354
7353
|
filter: e
|
|
@@ -7371,7 +7370,7 @@ var nf = p.object({
|
|
|
7371
7370
|
}
|
|
7372
7371
|
}
|
|
7373
7372
|
};
|
|
7374
|
-
let { outcomes: a } = await
|
|
7373
|
+
let { outcomes: a } = await Q(t, r.map((e) => {
|
|
7375
7374
|
let { id: t, color: n, description: r, ...i } = e;
|
|
7376
7375
|
return T("filter_update", {
|
|
7377
7376
|
id: t,
|
|
@@ -7395,10 +7394,10 @@ var nf = p.object({
|
|
|
7395
7394
|
error: u
|
|
7396
7395
|
});
|
|
7397
7396
|
}
|
|
7398
|
-
e && (l =
|
|
7397
|
+
e && (l = cf(e, new Set(c)));
|
|
7399
7398
|
}
|
|
7400
7399
|
return {
|
|
7401
|
-
textContent:
|
|
7400
|
+
textContent: Y(lf({
|
|
7402
7401
|
filters: l,
|
|
7403
7402
|
updatedIds: c,
|
|
7404
7403
|
skippedCount: i,
|
|
@@ -7418,18 +7417,18 @@ var nf = p.object({
|
|
|
7418
7417
|
};
|
|
7419
7418
|
}
|
|
7420
7419
|
};
|
|
7421
|
-
function
|
|
7420
|
+
function cf(e, t) {
|
|
7422
7421
|
return e.filter((e) => !e.isDeleted && t.has(e.id)).map((e) => ({
|
|
7423
7422
|
id: e.id,
|
|
7424
7423
|
name: e.name,
|
|
7425
7424
|
query: e.query,
|
|
7426
|
-
description:
|
|
7427
|
-
color:
|
|
7425
|
+
description: Yi(e),
|
|
7426
|
+
color: K.parse(e.color),
|
|
7428
7427
|
isFavorite: e.isFavorite,
|
|
7429
7428
|
itemOrder: e.itemOrder
|
|
7430
7429
|
}));
|
|
7431
7430
|
}
|
|
7432
|
-
function
|
|
7431
|
+
function lf({ filters: e, updatedIds: t, skippedCount: n, readBackError: r }) {
|
|
7433
7432
|
let i = t.length, a = `Updated ${i} filter${i === 1 ? "" : "s"}`;
|
|
7434
7433
|
if (n > 0 && (a += ` (${n} skipped - no changes)`), r) a += `: ${t.join(", ")}\nThe updated filters could not be read back: ${r}`;
|
|
7435
7434
|
else if (e.length > 0) {
|
|
@@ -7438,23 +7437,23 @@ function cf({ filters: e, updatedIds: t, skippedCount: n, readBackError: r }) {
|
|
|
7438
7437
|
}
|
|
7439
7438
|
return a;
|
|
7440
7439
|
}
|
|
7441
|
-
function
|
|
7440
|
+
function uf({ id: e, ...t }) {
|
|
7442
7441
|
return Object.values(t).every((e) => e === void 0) ? "no-fields" : null;
|
|
7443
7442
|
}
|
|
7444
7443
|
// src/tools/update-folders.ts
|
|
7445
|
-
var
|
|
7444
|
+
var df = p.object({
|
|
7446
7445
|
id: p.string().min(1).describe("The ID of the folder to rename."),
|
|
7447
7446
|
name: p.string().min(1).describe("The new name of the folder.")
|
|
7448
|
-
}),
|
|
7449
|
-
folders: p.array(
|
|
7450
|
-
failures: p.array(
|
|
7447
|
+
}), ff = { folders: p.array(df).min(1).max(O.ITEMS_PER_OPERATION).describe("The folders to rename.") }, pf = {
|
|
7448
|
+
folders: p.array(vi).describe("The renamed folders."),
|
|
7449
|
+
failures: p.array(J).describe("Folders that could not be renamed, with the reason for each."),
|
|
7451
7450
|
successCount: p.number(),
|
|
7452
7451
|
failureCount: p.number()
|
|
7453
|
-
},
|
|
7452
|
+
}, mf = {
|
|
7454
7453
|
name: B.UPDATE_FOLDERS,
|
|
7455
7454
|
description: "Rename one or more workspace folders.",
|
|
7456
|
-
parameters:
|
|
7457
|
-
outputSchema:
|
|
7455
|
+
parameters: ff,
|
|
7456
|
+
outputSchema: pf,
|
|
7458
7457
|
annotations: {
|
|
7459
7458
|
readOnlyHint: !1,
|
|
7460
7459
|
destructiveHint: !0,
|
|
@@ -7463,9 +7462,9 @@ var uf = p.object({
|
|
|
7463
7462
|
async execute({ folders: e }, t) {
|
|
7464
7463
|
let { succeeded: n, failures: r } = I(e, await Promise.allSettled(e.map(({ id: e, name: n }) => R(() => t.updateFolder(e, { name: n })))), (e) => e.id), i = n.map(({ value: e }) => e);
|
|
7465
7464
|
return L(B.UPDATE_FOLDERS, e.length, r), {
|
|
7466
|
-
textContent:
|
|
7465
|
+
textContent: hf(i, r),
|
|
7467
7466
|
structuredContent: {
|
|
7468
|
-
folders: i.map(
|
|
7467
|
+
folders: i.map(yi),
|
|
7469
7468
|
failures: r,
|
|
7470
7469
|
successCount: i.length,
|
|
7471
7470
|
failureCount: r.length
|
|
@@ -7473,41 +7472,41 @@ var uf = p.object({
|
|
|
7473
7472
|
};
|
|
7474
7473
|
}
|
|
7475
7474
|
};
|
|
7476
|
-
function
|
|
7475
|
+
function hf(e, t) {
|
|
7477
7476
|
let n = e.length, r = e.map((e) => `• ${e.name} (id=${e.id})`);
|
|
7478
|
-
return
|
|
7477
|
+
return Y(n > 0 ? `Renamed ${n} folder${n === 1 ? "" : "s"}:\n${r.join("\n")}` : "Renamed 0 folders", t);
|
|
7479
7478
|
}
|
|
7480
7479
|
// src/tools/update-labels.ts
|
|
7481
|
-
var
|
|
7480
|
+
var gf = p.object({
|
|
7482
7481
|
labelType: p.literal("personal").describe("Update a personal label, identified by its ID."),
|
|
7483
7482
|
id: p.string().min(1).describe("The ID of the personal label to update."),
|
|
7484
7483
|
name: p.string().min(1).max(128).optional().describe("The new name of the label."),
|
|
7485
|
-
color:
|
|
7484
|
+
color: pi,
|
|
7486
7485
|
order: p.number().int().optional().describe("The new position of the label in the label list."),
|
|
7487
7486
|
isFavorite: p.boolean().optional().describe("Whether to mark the label as a favorite.")
|
|
7488
|
-
}),
|
|
7487
|
+
}), _f = p.object({
|
|
7489
7488
|
labelType: p.literal("shared").describe("Rename a shared label across all tasks. Shared labels are identified by name; only renaming is supported (no color, order, or favorite)."),
|
|
7490
7489
|
name: p.string().min(1).describe("The current name of the shared label."),
|
|
7491
7490
|
newName: p.string().min(1).describe("The new name for the shared label.")
|
|
7492
|
-
}),
|
|
7491
|
+
}), vf = p.discriminatedUnion("labelType", [gf, _f]), yf = { labels: p.array(vf).min(1).max(O.ITEMS_PER_OPERATION).describe("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.") }, bf = p.object({
|
|
7493
7492
|
name: p.string().describe("The previous name of the shared label."),
|
|
7494
7493
|
newName: p.string().describe("The new name of the shared label.")
|
|
7495
|
-
}),
|
|
7496
|
-
updatedLabels: p.array(
|
|
7497
|
-
renamedSharedLabels: p.array(
|
|
7494
|
+
}), xf = {
|
|
7495
|
+
updatedLabels: p.array(wi).describe("The updated personal labels."),
|
|
7496
|
+
renamedSharedLabels: p.array(bf).describe("The shared labels that were renamed."),
|
|
7498
7497
|
totalCount: p.number().describe("The total number of successful operations (personal + shared)."),
|
|
7499
|
-
failures: p.array(
|
|
7498
|
+
failures: p.array(J).describe("Labels that could not be updated, identified by ID (personal) or name (shared), with the reason for each."),
|
|
7500
7499
|
appliedOperations: p.object({
|
|
7501
7500
|
updateCount: p.number().describe("Number of personal labels updated."),
|
|
7502
7501
|
renameCount: p.number().describe("Number of shared labels renamed."),
|
|
7503
7502
|
skippedCount: p.number().describe("Number of operations skipped (no changes or shared label not found)."),
|
|
7504
7503
|
failureCount: p.number()
|
|
7505
7504
|
}).describe("Summary of operations performed.")
|
|
7506
|
-
},
|
|
7505
|
+
}, Sf = {
|
|
7507
7506
|
name: B.UPDATE_LABELS,
|
|
7508
7507
|
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.",
|
|
7509
|
-
parameters:
|
|
7510
|
-
outputSchema:
|
|
7508
|
+
parameters: yf,
|
|
7509
|
+
outputSchema: xf,
|
|
7511
7510
|
annotations: {
|
|
7512
7511
|
readOnlyHint: !1,
|
|
7513
7512
|
destructiveHint: !0,
|
|
@@ -7516,7 +7515,7 @@ var hf = p.object({
|
|
|
7516
7515
|
async execute(e, t) {
|
|
7517
7516
|
let { labels: n } = e, { succeeded: r, failures: i } = I(n, await Promise.allSettled(n.map(async (e) => {
|
|
7518
7517
|
if (e.labelType === "personal") {
|
|
7519
|
-
let n =
|
|
7518
|
+
let n = wf(e);
|
|
7520
7519
|
if (n !== null) return {
|
|
7521
7520
|
kind: "skipped",
|
|
7522
7521
|
reason: n
|
|
@@ -7540,12 +7539,12 @@ var hf = p.object({
|
|
|
7540
7539
|
};
|
|
7541
7540
|
})), (e) => e.labelType === "personal" ? e.id : e.name), a = r.map(({ value: e }) => e);
|
|
7542
7541
|
L(B.UPDATE_LABELS, n.length, i, { redactItems: !0 });
|
|
7543
|
-
let o = a.filter((e) => e.kind === "updated").map((e) =>
|
|
7542
|
+
let o = a.filter((e) => e.kind === "updated").map((e) => wi.parse(e.label)), s = a.filter((e) => e.kind === "renamed").map(({ name: e, newName: t }) => ({
|
|
7544
7543
|
name: e,
|
|
7545
7544
|
newName: t
|
|
7546
7545
|
})), c = a.filter((e) => e.kind === "skipped").length, l = a.filter((e) => e.kind === "skipped" && e.reason === "no-fields").length, u = a.filter((e) => e.kind === "skipped" && e.reason === "not-found").length;
|
|
7547
7546
|
return {
|
|
7548
|
-
textContent:
|
|
7547
|
+
textContent: Y(Cf({
|
|
7549
7548
|
updatedLabels: o,
|
|
7550
7549
|
renamedSharedLabels: s,
|
|
7551
7550
|
skippedNoFields: l,
|
|
@@ -7566,7 +7565,7 @@ var hf = p.object({
|
|
|
7566
7565
|
};
|
|
7567
7566
|
}
|
|
7568
7567
|
};
|
|
7569
|
-
function
|
|
7568
|
+
function Cf({ updatedLabels: e, renamedSharedLabels: t, skippedNoFields: n, skippedNotFound: r }) {
|
|
7570
7569
|
let i = e.length, a = t.length, o = i + a, s = [];
|
|
7571
7570
|
s.push(`Updated ${o} label${o === 1 ? "" : "s"} (${i} personal, ${a} shared)`);
|
|
7572
7571
|
let c = [];
|
|
@@ -7580,34 +7579,34 @@ function Sf({ updatedLabels: e, renamedSharedLabels: t, skippedNoFields: n, skip
|
|
|
7580
7579
|
}
|
|
7581
7580
|
return s.join("\n");
|
|
7582
7581
|
}
|
|
7583
|
-
function
|
|
7582
|
+
function wf({ id: e, labelType: t, ...n }) {
|
|
7584
7583
|
return Object.values(n).every((e) => e === void 0) ? "no-fields" : null;
|
|
7585
7584
|
}
|
|
7586
7585
|
// src/tools/update-projects.ts
|
|
7587
|
-
var { FIND_FOLDERS:
|
|
7586
|
+
var { FIND_FOLDERS: Tf } = B, Ef = p.object({
|
|
7588
7587
|
id: p.string().min(1).describe("The ID of the project to update."),
|
|
7589
7588
|
name: p.string().min(1).optional().describe("The new name of the project."),
|
|
7590
7589
|
isFavorite: p.boolean().optional().describe("Whether the project is a favorite."),
|
|
7591
7590
|
viewStyle: p.enum(x).optional().describe("The project view style."),
|
|
7592
7591
|
description: p.preprocess((e) => e === null ? "" : e, p.string().describe("The description of the project (Markdown). Pass null (or an empty string) to clear it.")).optional(),
|
|
7593
|
-
color:
|
|
7592
|
+
color: pi,
|
|
7594
7593
|
icon: p.enum([...b, "remove"]).optional().describe("The project icon, or \"remove\" to restore the default # icon."),
|
|
7595
|
-
folderId: p.string().min(1).optional().describe(`Move a workspace project into this folder (see ${
|
|
7596
|
-
}),
|
|
7597
|
-
projects: p.array(
|
|
7594
|
+
folderId: p.string().min(1).optional().describe(`Move a workspace project into this folder (see ${Tf}), or "remove" for the workspace's top level.`)
|
|
7595
|
+
}), Df = { projects: p.array(Ef).min(1).max(O.ITEMS_PER_OPERATION).describe("The projects to update.") }, Of = {
|
|
7596
|
+
projects: p.array(hi).describe("The updated projects."),
|
|
7598
7597
|
totalCount: p.number().describe("The total number of projects updated."),
|
|
7599
7598
|
updatedProjectIds: p.array(p.string()).describe("The IDs of the updated projects."),
|
|
7600
|
-
failures: p.array(
|
|
7599
|
+
failures: p.array(J).describe("Projects that could not be updated, with the reason for each."),
|
|
7601
7600
|
appliedOperations: p.object({
|
|
7602
7601
|
updateCount: p.number().describe("The number of projects actually updated."),
|
|
7603
7602
|
skippedCount: p.number().describe("The number of projects skipped (no changes)."),
|
|
7604
7603
|
failureCount: p.number()
|
|
7605
7604
|
}).describe("Summary of operations performed.")
|
|
7606
|
-
},
|
|
7605
|
+
}, kf = {
|
|
7607
7606
|
name: B.UPDATE_PROJECTS,
|
|
7608
7607
|
description: "Update multiple existing projects with new values.",
|
|
7609
|
-
parameters:
|
|
7610
|
-
outputSchema:
|
|
7608
|
+
parameters: Df,
|
|
7609
|
+
outputSchema: Of,
|
|
7611
7610
|
annotations: {
|
|
7612
7611
|
readOnlyHint: !1,
|
|
7613
7612
|
destructiveHint: !0,
|
|
@@ -7615,7 +7614,7 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7615
7614
|
},
|
|
7616
7615
|
async execute(e, t) {
|
|
7617
7616
|
let { projects: n } = e, { succeeded: r, failures: i } = I(n, await Promise.allSettled(n.map(async (e) => {
|
|
7618
|
-
let n =
|
|
7617
|
+
let n = jf(e);
|
|
7619
7618
|
if (n !== null) return {
|
|
7620
7619
|
kind: "skipped",
|
|
7621
7620
|
reason: n
|
|
@@ -7630,9 +7629,9 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7630
7629
|
project: await R(() => t.updateProject(r, s))
|
|
7631
7630
|
};
|
|
7632
7631
|
})), (e) => e.id), a = [], o = 0, s = 0;
|
|
7633
|
-
for (let { value: e } of r) e.kind === "updated" ? a.push(
|
|
7632
|
+
for (let { value: e } of r) e.kind === "updated" ? a.push(Yr(e.project)) : e.reason === "no-fields" ? o++ : s++;
|
|
7634
7633
|
return L(B.UPDATE_PROJECTS, n.length, i), {
|
|
7635
|
-
textContent:
|
|
7634
|
+
textContent: Af({
|
|
7636
7635
|
projects: a,
|
|
7637
7636
|
skippedNoFields: o,
|
|
7638
7637
|
skippedNoValidValues: s,
|
|
@@ -7652,56 +7651,56 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7652
7651
|
};
|
|
7653
7652
|
}
|
|
7654
7653
|
};
|
|
7655
|
-
function
|
|
7654
|
+
function Af({ projects: e, skippedNoFields: t, skippedNoValidValues: n, failures: r }) {
|
|
7656
7655
|
let i = e.length, a = e.map((e) => `• ${e.name} (id=${e.id})`).join("\n"), o = `Updated ${i} project${i === 1 ? "" : "s"}`, s = [];
|
|
7657
|
-
return t > 0 && s.push(`${t} skipped - no changes`), n > 0 && s.push(`${n} skipped - no valid field values`), s.length > 0 && (o += ` (${s.join(", ")})`), i > 0 && (o += `:\n${a}`),
|
|
7656
|
+
return t > 0 && s.push(`${t} skipped - no changes`), n > 0 && s.push(`${n} skipped - no valid field values`), s.length > 0 && (o += ` (${s.join(", ")})`), i > 0 && (o += `:\n${a}`), Y(o, r);
|
|
7658
7657
|
}
|
|
7659
|
-
function
|
|
7658
|
+
function jf({ id: e, ...t }) {
|
|
7660
7659
|
let n = Object.values(t);
|
|
7661
7660
|
return n.length === 0 ? "no-fields" : n.every((e) => e === void 0) ? "no-valid-values" : null;
|
|
7662
7661
|
}
|
|
7663
7662
|
// src/tools/update-reminders.ts
|
|
7664
|
-
var
|
|
7663
|
+
var Mf = p.object({
|
|
7665
7664
|
type: p.literal("relative"),
|
|
7666
7665
|
id: p.string().min(1).describe("The ID of the relative reminder to update."),
|
|
7667
7666
|
minuteOffset: p.number().int().min(0).optional().describe("New minute offset before task due time."),
|
|
7668
|
-
service:
|
|
7669
|
-
isUrgent:
|
|
7670
|
-
notifyUser:
|
|
7671
|
-
}),
|
|
7667
|
+
service: Ja.optional().describe("New delivery method: \"email\" or \"push\"."),
|
|
7668
|
+
isUrgent: Za,
|
|
7669
|
+
notifyUser: eo
|
|
7670
|
+
}), Nf = p.object({
|
|
7672
7671
|
type: p.literal("absolute"),
|
|
7673
7672
|
id: p.string().min(1).describe("The ID of the absolute reminder to update."),
|
|
7674
|
-
due:
|
|
7675
|
-
service:
|
|
7676
|
-
isUrgent:
|
|
7677
|
-
notifyUser:
|
|
7678
|
-
}),
|
|
7673
|
+
due: Ya.optional().describe("New due date/time for the reminder."),
|
|
7674
|
+
service: Ja.optional().describe("New delivery method: \"email\" or \"push\"."),
|
|
7675
|
+
isUrgent: Za,
|
|
7676
|
+
notifyUser: eo
|
|
7677
|
+
}), Pf = p.object({
|
|
7679
7678
|
type: p.literal("location"),
|
|
7680
7679
|
id: p.string().min(1).describe("The ID of the location reminder to update."),
|
|
7681
7680
|
name: p.string().optional().describe("New location name."),
|
|
7682
7681
|
locLat: p.string().optional().describe("New latitude."),
|
|
7683
7682
|
locLong: p.string().optional().describe("New longitude."),
|
|
7684
|
-
locTrigger:
|
|
7683
|
+
locTrigger: Xa.optional().describe("New trigger condition: \"on_enter\" or \"on_leave\"."),
|
|
7685
7684
|
radius: p.number().int().optional().describe("New radius in meters."),
|
|
7686
|
-
notifyUser:
|
|
7687
|
-
}),
|
|
7688
|
-
jf,
|
|
7685
|
+
notifyUser: eo
|
|
7686
|
+
}), Ff = p.discriminatedUnion("type", [
|
|
7689
7687
|
Mf,
|
|
7690
|
-
Nf
|
|
7691
|
-
|
|
7692
|
-
|
|
7688
|
+
Nf,
|
|
7689
|
+
Pf
|
|
7690
|
+
]), If = { reminders: p.array(Ff).min(1).max(25).describe("Array of reminders to update (max 25). Each must include the reminder type and ID. Only include fields that need to change.") }, Lf = {
|
|
7691
|
+
reminders: p.array(Ei).describe("The updated reminders."),
|
|
7693
7692
|
totalCount: p.number().describe("Total reminders updated."),
|
|
7694
7693
|
updatedReminderIds: p.array(p.string()).describe("IDs of updated reminders."),
|
|
7695
|
-
failures: p.array(
|
|
7694
|
+
failures: p.array(J).describe("Reminders that could not be updated, with the reason for each."),
|
|
7696
7695
|
appliedOperations: p.object({
|
|
7697
7696
|
updateCount: p.number(),
|
|
7698
7697
|
failureCount: p.number()
|
|
7699
7698
|
})
|
|
7700
|
-
},
|
|
7699
|
+
}, Rf = {
|
|
7701
7700
|
name: B.UPDATE_REMINDERS,
|
|
7702
7701
|
description: "Update existing reminders. Each reminder must specify its type (\"relative\", \"absolute\", or \"location\") and ID. Only include fields that need to change.",
|
|
7703
|
-
parameters:
|
|
7704
|
-
outputSchema:
|
|
7702
|
+
parameters: If,
|
|
7703
|
+
outputSchema: Lf,
|
|
7705
7704
|
annotations: {
|
|
7706
7705
|
readOnlyHint: !1,
|
|
7707
7706
|
destructiveHint: !0,
|
|
@@ -7709,7 +7708,7 @@ var jf = p.object({
|
|
|
7709
7708
|
openWorldHint: !0
|
|
7710
7709
|
},
|
|
7711
7710
|
async execute(e, t) {
|
|
7712
|
-
let { reminders: n } = e, r = await
|
|
7711
|
+
let { reminders: n } = e, r = await Ga(t, n.map((e) => e.notifyUser)), { succeeded: i, failures: a } = I(n, await Promise.allSettled(n.map(async (e, n) => {
|
|
7713
7712
|
let i = r[n];
|
|
7714
7713
|
if (i?.status === "rejected") throw i.reason;
|
|
7715
7714
|
let a = i?.value, o = a === void 0 ? {} : { notifyUid: a };
|
|
@@ -7738,14 +7737,14 @@ var jf = p.object({
|
|
|
7738
7737
|
}));
|
|
7739
7738
|
}
|
|
7740
7739
|
}
|
|
7741
|
-
})), (e) => e.id), o = i.map(({ value: e }) =>
|
|
7740
|
+
})), (e) => e.id), o = i.map(({ value: e }) => ni(e)), s = i.map(({ index: e }) => {
|
|
7742
7741
|
let t = r[e];
|
|
7743
7742
|
return t?.status === "fulfilled" ? t.value : void 0;
|
|
7744
7743
|
});
|
|
7745
7744
|
L(B.UPDATE_REMINDERS, n.length, a);
|
|
7746
7745
|
let c = o.length === 1 ? "reminder" : "reminders";
|
|
7747
7746
|
return {
|
|
7748
|
-
textContent:
|
|
7747
|
+
textContent: Y([`Updated ${o.length} ${c}`, ...qa(o, s)].join("\n"), a),
|
|
7749
7748
|
structuredContent: {
|
|
7750
7749
|
reminders: o,
|
|
7751
7750
|
totalCount: o.length,
|
|
@@ -7758,41 +7757,41 @@ var jf = p.object({
|
|
|
7758
7757
|
}
|
|
7759
7758
|
};
|
|
7760
7759
|
}
|
|
7761
|
-
},
|
|
7760
|
+
}, zf = p.object({
|
|
7762
7761
|
id: p.string().min(1).describe("The ID of the section to update."),
|
|
7763
7762
|
name: p.string().min(1).optional().describe("The new name of the section."),
|
|
7764
7763
|
description: p.preprocess((e) => e === null ? "" : e, p.string().describe("The description of the section (Markdown). Pass null (or an empty string) to clear it.")).optional(),
|
|
7765
7764
|
isArchived: p.boolean().optional().describe(`true archives (keeping its tasks, unlike ${B.DELETE_OBJECT}), false unarchives.`)
|
|
7766
|
-
}).refine((e) => e.name !== void 0 || e.description !== void 0 || e.isArchived !== void 0, { message: "Provide at least one of \"name\", \"description\" or \"isArchived\" to update." }),
|
|
7767
|
-
sections: p.array(
|
|
7765
|
+
}).refine((e) => e.name !== void 0 || e.description !== void 0 || e.isArchived !== void 0, { message: "Provide at least one of \"name\", \"description\" or \"isArchived\" to update." }), Bf = { sections: p.array(zf).min(1).max(O.ITEMS_PER_OPERATION).describe("The sections to update.") }, Vf = {
|
|
7766
|
+
sections: p.array(gi).describe("The updated sections."),
|
|
7768
7767
|
totalCount: p.number().describe("The total number of sections updated."),
|
|
7769
7768
|
updatedSectionIds: p.array(p.string()).describe("The IDs of the updated sections."),
|
|
7770
|
-
failures: p.array(
|
|
7769
|
+
failures: p.array(J).describe("Sections that could not be updated, with the reason for each."),
|
|
7771
7770
|
appliedOperations: p.object({
|
|
7772
7771
|
updateCount: p.number(),
|
|
7773
7772
|
failureCount: p.number()
|
|
7774
7773
|
})
|
|
7775
|
-
},
|
|
7774
|
+
}, Hf = {
|
|
7776
7775
|
name: B.UPDATE_SECTIONS,
|
|
7777
7776
|
description: "Update, archive or unarchive multiple existing sections.",
|
|
7778
|
-
parameters:
|
|
7779
|
-
outputSchema:
|
|
7777
|
+
parameters: Bf,
|
|
7778
|
+
outputSchema: Vf,
|
|
7780
7779
|
annotations: {
|
|
7781
7780
|
readOnlyHint: !1,
|
|
7782
7781
|
destructiveHint: !0,
|
|
7783
7782
|
idempotentHint: !1
|
|
7784
7783
|
},
|
|
7785
7784
|
async execute({ sections: e }, t) {
|
|
7786
|
-
let n = I(e, await Promise.allSettled(e.map((e) =>
|
|
7785
|
+
let n = I(e, await Promise.allSettled(e.map((e) => Wf(e, t))), (e) => e.id), r = n.succeeded.map(({ item: e, value: t }) => ({
|
|
7787
7786
|
id: e.id,
|
|
7788
7787
|
...t
|
|
7789
7788
|
})), i = [...n.failures, ...r.flatMap(({ id: e, partial: t }) => t ? [{
|
|
7790
7789
|
item: e,
|
|
7791
7790
|
...t,
|
|
7792
|
-
code:
|
|
7791
|
+
code: Uf
|
|
7793
7792
|
}] : [])], a = r.map(({ section: e }) => e);
|
|
7794
7793
|
return L(B.UPDATE_SECTIONS, e.length, i), {
|
|
7795
|
-
textContent:
|
|
7794
|
+
textContent: Kf({
|
|
7796
7795
|
updated: r.map(({ section: e, archiveChange: t }) => ({
|
|
7797
7796
|
section: e,
|
|
7798
7797
|
isArchived: t
|
|
@@ -7800,7 +7799,7 @@ var jf = p.object({
|
|
|
7800
7799
|
failures: i
|
|
7801
7800
|
}),
|
|
7802
7801
|
structuredContent: {
|
|
7803
|
-
sections: a.map(
|
|
7802
|
+
sections: a.map(_i),
|
|
7804
7803
|
totalCount: a.length,
|
|
7805
7804
|
updatedSectionIds: a.map((e) => e.id),
|
|
7806
7805
|
failures: i,
|
|
@@ -7811,8 +7810,8 @@ var jf = p.object({
|
|
|
7811
7810
|
}
|
|
7812
7811
|
};
|
|
7813
7812
|
}
|
|
7814
|
-
},
|
|
7815
|
-
async function
|
|
7813
|
+
}, Uf = "PARTIAL_UPDATE_APPLIED";
|
|
7814
|
+
async function Wf({ id: e, name: t, description: n, isArchived: r }, i) {
|
|
7816
7815
|
let a = [];
|
|
7817
7816
|
if (r === !1 && a.push({
|
|
7818
7817
|
label: "unarchive",
|
|
@@ -7852,37 +7851,37 @@ async function Uf({ id: e, name: t, description: n, isArchived: r }, i) {
|
|
|
7852
7851
|
}
|
|
7853
7852
|
return o;
|
|
7854
7853
|
}
|
|
7855
|
-
var
|
|
7854
|
+
var Gf = {
|
|
7856
7855
|
true: " - archived",
|
|
7857
7856
|
false: " - unarchived"
|
|
7858
7857
|
};
|
|
7859
|
-
function
|
|
7858
|
+
function Kf({ updated: e, failures: t }) {
|
|
7860
7859
|
let n = e.length, r = e.map(({ section: e, isArchived: t }) => {
|
|
7861
|
-
let n = t === void 0 ? "" :
|
|
7860
|
+
let n = t === void 0 ? "" : Gf[`${t}`];
|
|
7862
7861
|
return `• ${e.name} (id=${e.id}, projectId=${e.projectId})${n}`;
|
|
7863
7862
|
}).join("\n");
|
|
7864
|
-
return
|
|
7863
|
+
return Y(n > 0 ? `Updated ${n} section${n === 1 ? "" : "s"}:\n${r}` : "Updated 0 sections", t);
|
|
7865
7864
|
}
|
|
7866
7865
|
// src/utils/move-planner.ts
|
|
7867
|
-
function
|
|
7866
|
+
function qf(e, t) {
|
|
7868
7867
|
return t.projectId === void 0 ? t.sectionId === void 0 ? e.parentId === t.parentId : e.sectionId === t.sectionId && !e.parentId : e.projectId === t.projectId && !e.sectionId && !e.parentId;
|
|
7869
7868
|
}
|
|
7870
|
-
function
|
|
7869
|
+
function Jf(e, t) {
|
|
7871
7870
|
return t.projectId === void 0 ? t.sectionId === void 0 ? e.parentId === t.parentId : e.sectionId === t.sectionId : e.projectId === t.projectId;
|
|
7872
7871
|
}
|
|
7873
|
-
function
|
|
7872
|
+
function Yf(e) {
|
|
7874
7873
|
return e.projectId === void 0 ? e.sectionId === void 0 ? `parent:${e.parentId}` : `section:${e.sectionId}` : `project:${e.projectId}`;
|
|
7875
7874
|
}
|
|
7876
|
-
function
|
|
7875
|
+
function Xf(e) {
|
|
7877
7876
|
let t = [];
|
|
7878
7877
|
return e.projectId && t.push({ projectId: e.projectId }), e.sectionId && t.push({ sectionId: e.sectionId }), e.parentId && t.push({ parentId: e.parentId }), t;
|
|
7879
7878
|
}
|
|
7880
|
-
function
|
|
7881
|
-
let r =
|
|
7879
|
+
function Zf({ taskId: e, request: t, current: n }) {
|
|
7880
|
+
let r = Xf(t);
|
|
7882
7881
|
if (r.length === 0) return { redundantMoveSkipped: !1 };
|
|
7883
7882
|
let i = r, a = !1;
|
|
7884
7883
|
if (n) {
|
|
7885
|
-
let e = r.length === 1 ? (e) =>
|
|
7884
|
+
let e = r.length === 1 ? (e) => qf(n, e) : (e) => Jf(n, e);
|
|
7886
7885
|
i = r.filter((t) => !e(t)), a = i.length < r.length;
|
|
7887
7886
|
}
|
|
7888
7887
|
if (i.length === 0) return { redundantMoveSkipped: a };
|
|
@@ -7893,7 +7892,7 @@ function Xf({ taskId: e, request: t, current: n }) {
|
|
|
7893
7892
|
};
|
|
7894
7893
|
}
|
|
7895
7894
|
// src/tools/update-tasks.ts
|
|
7896
|
-
var
|
|
7895
|
+
var Qf = p.object({
|
|
7897
7896
|
id: p.string().min(1).describe("The ID of the task to update."),
|
|
7898
7897
|
content: p.string().optional().describe("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."),
|
|
7899
7898
|
description: p.string().optional().describe("New additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown."),
|
|
@@ -7909,26 +7908,26 @@ var Zf = p.object({
|
|
|
7909
7908
|
responsibleUser: p.preprocess((e) => e === null ? "unassign" : e, p.string()).optional().describe("Change task assignment. Use \"unassign\" to remove assignment. Can be \"me\" (assigns to current user), a user ID, name, or email. User must be a project collaborator."),
|
|
7910
7909
|
labels: p.array(p.string()).max(O.LABELS_PER_TASK).optional().describe("The new labels for the task. Replaces all existing labels."),
|
|
7911
7910
|
isUncompletable: p.boolean().optional().describe("Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed.")
|
|
7912
|
-
}),
|
|
7911
|
+
}), $f = (e) => !!(e.projectId || e.sectionId || e.parentId), ep = (e) => Object.keys(e).length > 0, tp = ["remove", "no date"], np = [
|
|
7913
7912
|
"remove",
|
|
7914
7913
|
"no date",
|
|
7915
7914
|
"no deadline"
|
|
7916
|
-
],
|
|
7917
|
-
tasks: p.array(
|
|
7915
|
+
], rp = "no date", ip = O.TASKS_PER_OPERATION, ap = { tasks: p.array(Qf).min(1).max(ip).describe(`The tasks to update (max ${ip}).`) }, op = {
|
|
7916
|
+
tasks: p.array(q).describe("The updated tasks."),
|
|
7918
7917
|
totalCount: p.number().describe("The total number of tasks updated."),
|
|
7919
7918
|
updatedTaskIds: p.array(p.string()).describe("The IDs of the updated tasks."),
|
|
7920
|
-
failures: p.array(
|
|
7919
|
+
failures: p.array(J).describe("Tasks that could not be updated, with the reason for each."),
|
|
7921
7920
|
appliedOperations: p.object({
|
|
7922
7921
|
updateCount: p.number().describe("The number of tasks actually updated."),
|
|
7923
7922
|
skippedCount: p.number().describe("The number of tasks skipped (no changes)."),
|
|
7924
7923
|
failureCount: p.number(),
|
|
7925
7924
|
redundantMovesSkipped: p.number().describe("Moves not performed because the task was already in the requested destination. A non-zero count means container fields were sent that did not need to be.")
|
|
7926
7925
|
}).describe("Summary of operations performed.")
|
|
7927
|
-
},
|
|
7926
|
+
}, sp = {
|
|
7928
7927
|
name: B.UPDATE_TASKS,
|
|
7929
7928
|
description: "Update existing tasks including content, dates, priorities, and assignments. Send only the fields that change.",
|
|
7930
|
-
parameters:
|
|
7931
|
-
outputSchema:
|
|
7929
|
+
parameters: ap,
|
|
7930
|
+
outputSchema: op,
|
|
7932
7931
|
annotations: {
|
|
7933
7932
|
readOnlyHint: !1,
|
|
7934
7933
|
destructiveHint: !0,
|
|
@@ -7936,7 +7935,7 @@ var Zf = p.object({
|
|
|
7936
7935
|
openWorldHint: !0
|
|
7937
7936
|
},
|
|
7938
7937
|
async execute(e, t) {
|
|
7939
|
-
let { tasks: n } = p.object(
|
|
7938
|
+
let { tasks: n } = p.object(ap).parse(e), r = n.map(() => ({ kind: "skipped" })), i = (e, t, n) => {
|
|
7940
7939
|
r[e] = {
|
|
7941
7940
|
kind: "failed",
|
|
7942
7941
|
error: t,
|
|
@@ -7947,7 +7946,7 @@ var Zf = p.object({
|
|
|
7947
7946
|
}, o = n.map((e, t) => ({
|
|
7948
7947
|
task: e,
|
|
7949
7948
|
index: t
|
|
7950
|
-
})).filter(({ task: e }) =>
|
|
7949
|
+
})).filter(({ task: e }) => vp(e)), s = await lp(o.map(({ task: e }) => e), t), c = await Promise.allSettled(o.map(({ task: e, index: n }) => hp({
|
|
7951
7950
|
task: e,
|
|
7952
7951
|
index: n,
|
|
7953
7952
|
client: t,
|
|
@@ -7957,13 +7956,13 @@ var Zf = p.object({
|
|
|
7957
7956
|
let n = o[e]?.index ?? e;
|
|
7958
7957
|
t.status === "fulfilled" ? l.push(t.value) : a(n, t.reason);
|
|
7959
7958
|
}
|
|
7960
|
-
let { states: u, readFailed: d } = await
|
|
7959
|
+
let { states: u, readFailed: d } = await up({
|
|
7961
7960
|
client: t,
|
|
7962
|
-
ids: [...new Set(l.filter((e) =>
|
|
7961
|
+
ids: [...new Set(l.filter((e) => $f(e.moveRequest) || e.checkRecurrence).map((e) => e.id))]
|
|
7963
7962
|
});
|
|
7964
7963
|
for (let e of l) {
|
|
7965
7964
|
if (!e.checkRecurrence) continue;
|
|
7966
|
-
let t =
|
|
7965
|
+
let t = dp({
|
|
7967
7966
|
id: e.id,
|
|
7968
7967
|
current: u.get(e.id),
|
|
7969
7968
|
readFailed: d
|
|
@@ -7972,7 +7971,7 @@ var Zf = p.object({
|
|
|
7972
7971
|
}
|
|
7973
7972
|
let f = [];
|
|
7974
7973
|
for (let e of l) if (!e.failed) try {
|
|
7975
|
-
let t =
|
|
7974
|
+
let t = Zf({
|
|
7976
7975
|
taskId: e.id,
|
|
7977
7976
|
request: e.moveRequest,
|
|
7978
7977
|
current: u.get(e.id)
|
|
@@ -7986,7 +7985,7 @@ var Zf = p.object({
|
|
|
7986
7985
|
}
|
|
7987
7986
|
let m = /* @__PURE__ */ new Map(), h = [], g = (e) => {
|
|
7988
7987
|
let n = e.filter((e) => !e.failed);
|
|
7989
|
-
n.length !== 0 && h.push(
|
|
7988
|
+
n.length !== 0 && h.push(mp({
|
|
7990
7989
|
client: t,
|
|
7991
7990
|
items: n,
|
|
7992
7991
|
onUpdated: (e, t) => {
|
|
@@ -8006,7 +8005,7 @@ var Zf = p.object({
|
|
|
8006
8005
|
}
|
|
8007
8006
|
}));
|
|
8008
8007
|
}, _ = new Set(f.map(({ item: e }) => e.index));
|
|
8009
|
-
g(l.filter((e) => !_.has(e.index))), await
|
|
8008
|
+
g(l.filter((e) => !_.has(e.index))), await fp({
|
|
8010
8009
|
client: t,
|
|
8011
8010
|
moving: f,
|
|
8012
8011
|
results: m,
|
|
@@ -8020,19 +8019,19 @@ var Zf = p.object({
|
|
|
8020
8019
|
}
|
|
8021
8020
|
}), await Promise.all(h);
|
|
8022
8021
|
for (let e of l) {
|
|
8023
|
-
if (e.failed ||
|
|
8022
|
+
if (e.failed || ep(e.updateArgs)) continue;
|
|
8024
8023
|
let t = m.get(e.index);
|
|
8025
8024
|
t && "task" in t && (r[e.index] = {
|
|
8026
8025
|
kind: "updated",
|
|
8027
8026
|
task: t.task
|
|
8028
8027
|
});
|
|
8029
8028
|
}
|
|
8030
|
-
let { updatedTasks: v, failures: y, skippedCount: b } =
|
|
8029
|
+
let { updatedTasks: v, failures: y, skippedCount: b } = cp({
|
|
8031
8030
|
tasks: n,
|
|
8032
8031
|
outcomes: r
|
|
8033
|
-
}), x = l.filter((e) => e.redundantMoveSkipped).length, S = v.map(
|
|
8032
|
+
}), x = l.filter((e) => e.redundantMoveSkipped).length, S = v.map(G);
|
|
8034
8033
|
return L(B.UPDATE_TASKS, n.length, y), {
|
|
8035
|
-
textContent:
|
|
8034
|
+
textContent: _p({
|
|
8036
8035
|
tasks: S,
|
|
8037
8036
|
failures: y,
|
|
8038
8037
|
skippedCount: b,
|
|
@@ -8053,7 +8052,7 @@ var Zf = p.object({
|
|
|
8053
8052
|
};
|
|
8054
8053
|
}
|
|
8055
8054
|
};
|
|
8056
|
-
function
|
|
8055
|
+
function cp({ tasks: e, outcomes: t }) {
|
|
8057
8056
|
let n = [], r = [], i = 0;
|
|
8058
8057
|
for (let [a, o] of t.entries()) {
|
|
8059
8058
|
let t = e[a]?.id ?? `Task ${a + 1}`;
|
|
@@ -8074,15 +8073,15 @@ function sp({ tasks: e, outcomes: t }) {
|
|
|
8074
8073
|
skippedCount: i
|
|
8075
8074
|
};
|
|
8076
8075
|
}
|
|
8077
|
-
async function
|
|
8078
|
-
if (!e.some((e) =>
|
|
8076
|
+
async function lp(e, t) {
|
|
8077
|
+
if (!e.some((e) => Pr(e.projectId))) return {};
|
|
8079
8078
|
try {
|
|
8080
8079
|
return { projectId: (await R(() => t.getUser())).inboxProjectId };
|
|
8081
8080
|
} catch (e) {
|
|
8082
8081
|
return { error: e };
|
|
8083
8082
|
}
|
|
8084
8083
|
}
|
|
8085
|
-
async function
|
|
8084
|
+
async function up({ client: e, ids: t }) {
|
|
8086
8085
|
let n = /* @__PURE__ */ new Map();
|
|
8087
8086
|
if (t.length === 0) return {
|
|
8088
8087
|
states: n,
|
|
@@ -8091,7 +8090,7 @@ async function lp({ client: e, ids: t }) {
|
|
|
8091
8090
|
try {
|
|
8092
8091
|
let r = new Set(t), i = {
|
|
8093
8092
|
ids: t,
|
|
8094
|
-
limit:
|
|
8093
|
+
limit: ip
|
|
8095
8094
|
}, { results: a } = await R(() => e.getTasks(i));
|
|
8096
8095
|
for (let e of a) r.has(e.id) && n.set(e.id, e);
|
|
8097
8096
|
} catch (e) {
|
|
@@ -8106,15 +8105,15 @@ async function lp({ client: e, ids: t }) {
|
|
|
8106
8105
|
readFailed: !1
|
|
8107
8106
|
};
|
|
8108
8107
|
}
|
|
8109
|
-
function
|
|
8108
|
+
function dp({ id: e, current: t, readFailed: n }) {
|
|
8110
8109
|
if (n) return `Task ${e}: could not check whether the task is recurring, so its due date was not changed. Retry the update.`;
|
|
8111
8110
|
if (t?.due?.isRecurring) return `Task ${e} recurs ("${t.due.string}"). dueString would replace that rule and make it a one-time task, so nothing was changed. To move it to another date or time, use ${B.RESCHEDULE_TASKS} (it also accepts duration). To change or drop the recurrence on purpose, resend with replaceRecurrence: true.`;
|
|
8112
8111
|
}
|
|
8113
|
-
async function
|
|
8112
|
+
async function fp({ client: e, moving: t, results: n, onResolved: r }) {
|
|
8114
8113
|
if (t.length === 0) return;
|
|
8115
8114
|
let i = /* @__PURE__ */ new Map();
|
|
8116
8115
|
for (let e of t) {
|
|
8117
|
-
let t =
|
|
8116
|
+
let t = Yf(e.move), n = i.get(t);
|
|
8118
8117
|
n ? n.push(e) : i.set(t, [e]);
|
|
8119
8118
|
}
|
|
8120
8119
|
let a = It(e), o = [];
|
|
@@ -8151,7 +8150,7 @@ async function dp({ client: e, moving: t, results: n, onResolved: r }) {
|
|
|
8151
8150
|
}
|
|
8152
8151
|
}
|
|
8153
8152
|
if (o.length > 0) {
|
|
8154
|
-
await
|
|
8153
|
+
await pp({
|
|
8155
8154
|
client: e,
|
|
8156
8155
|
unresolved: o,
|
|
8157
8156
|
results: n
|
|
@@ -8159,8 +8158,8 @@ async function dp({ client: e, moving: t, results: n, onResolved: r }) {
|
|
|
8159
8158
|
for (let { group: e } of o) r(e);
|
|
8160
8159
|
}
|
|
8161
8160
|
}
|
|
8162
|
-
async function
|
|
8163
|
-
let { states: r, rateLimit: i } = await
|
|
8161
|
+
async function pp({ client: e, unresolved: t, results: n }) {
|
|
8162
|
+
let { states: r, rateLimit: i } = await up({
|
|
8164
8163
|
client: e,
|
|
8165
8164
|
ids: [...new Set(t.flatMap(({ group: e }) => e.map(({ item: e }) => e.id)))]
|
|
8166
8165
|
});
|
|
@@ -8171,16 +8170,16 @@ async function fp({ client: e, unresolved: t, results: n }) {
|
|
|
8171
8170
|
}, u = o === void 0 ? "Task not returned by the move" : P(o);
|
|
8172
8171
|
for (let { item: t } of e) {
|
|
8173
8172
|
let e = r.get(t.id);
|
|
8174
|
-
e &&
|
|
8173
|
+
e && qf(e, a) ? n.set(t.index, { task: e }) : n.set(t.index, {
|
|
8175
8174
|
error: u,
|
|
8176
8175
|
rateLimit: l
|
|
8177
8176
|
});
|
|
8178
8177
|
}
|
|
8179
8178
|
}
|
|
8180
8179
|
}
|
|
8181
|
-
async function
|
|
8180
|
+
async function mp({ client: e, items: t, onUpdated: n, onFailed: r }) {
|
|
8182
8181
|
let i = Lt(e);
|
|
8183
|
-
await Promise.all(t.filter((e) =>
|
|
8182
|
+
await Promise.all(t.filter((e) => ep(e.updateArgs)).map(async (t) => {
|
|
8184
8183
|
try {
|
|
8185
8184
|
n(t, await i(() => R(() => e.updateTask(t.id, t.updateArgs))));
|
|
8186
8185
|
} catch (e) {
|
|
@@ -8188,20 +8187,20 @@ async function pp({ client: e, items: t, onUpdated: n, onFailed: r }) {
|
|
|
8188
8187
|
}
|
|
8189
8188
|
}));
|
|
8190
8189
|
}
|
|
8191
|
-
async function
|
|
8190
|
+
async function hp({ task: e, index: t, client: n, inbox: r }) {
|
|
8192
8191
|
let { id: i, projectId: a, sectionId: o, parentId: s, dueString: c, duration: l, responsibleUser: u, priority: d, labels: f, deadlineDate: p, replaceRecurrence: m, ...h } = e;
|
|
8193
|
-
if (
|
|
8194
|
-
let g =
|
|
8192
|
+
if (Pr(a) && r.error !== void 0) throw r.error;
|
|
8193
|
+
let g = Pr(a) ? r.projectId : a, _ = {
|
|
8195
8194
|
...h,
|
|
8196
8195
|
...f !== void 0 && { labels: f }
|
|
8197
8196
|
};
|
|
8198
8197
|
d && (_.priority = cr(d));
|
|
8199
|
-
let v =
|
|
8198
|
+
let v = yp(c, tp, rp);
|
|
8200
8199
|
v !== void 0 && (_ = {
|
|
8201
8200
|
..._,
|
|
8202
8201
|
dueString: v
|
|
8203
8202
|
});
|
|
8204
|
-
let y =
|
|
8203
|
+
let y = yp(p, np, null);
|
|
8205
8204
|
if (y !== void 0 && (_ = {
|
|
8206
8205
|
..._,
|
|
8207
8206
|
deadlineDate: y
|
|
@@ -8215,7 +8214,7 @@ async function mp({ task: e, index: t, client: n, inbox: r }) {
|
|
|
8215
8214
|
}
|
|
8216
8215
|
return u !== void 0 && (_ = {
|
|
8217
8216
|
..._,
|
|
8218
|
-
assigneeId: await
|
|
8217
|
+
assigneeId: await gp(n, i, u)
|
|
8219
8218
|
}), {
|
|
8220
8219
|
index: t,
|
|
8221
8220
|
id: i,
|
|
@@ -8226,23 +8225,23 @@ async function mp({ task: e, index: t, client: n, inbox: r }) {
|
|
|
8226
8225
|
parentId: s
|
|
8227
8226
|
},
|
|
8228
8227
|
redundantMoveSkipped: !1,
|
|
8229
|
-
checkRecurrence: v !== void 0 && v !==
|
|
8228
|
+
checkRecurrence: v !== void 0 && v !== rp && m !== !0,
|
|
8230
8229
|
failed: !1
|
|
8231
8230
|
};
|
|
8232
8231
|
}
|
|
8233
|
-
async function
|
|
8232
|
+
async function gp(e, t, n) {
|
|
8234
8233
|
if (n === null || n === "unassign") return null;
|
|
8235
8234
|
let r = await go.validateTaskUpdateAssignment(e, t, n);
|
|
8236
8235
|
if (!r.isValid) {
|
|
8237
8236
|
let e = r.error?.message || "Assignment validation failed", n = r.error?.suggestions?.join(". ") || "";
|
|
8238
|
-
throw new (r.error?.type ===
|
|
8237
|
+
throw new (r.error?.type === $.USER_AMBIGUOUS ? st : Error)(`Task ${t}: ${e}${n ? `. ${n}` : ""}`);
|
|
8239
8238
|
}
|
|
8240
8239
|
return r.resolvedUser?.userId;
|
|
8241
8240
|
}
|
|
8242
|
-
function
|
|
8241
|
+
function _p({ tasks: e, failures: t, skippedCount: n, redundantMovesSkipped: r }) {
|
|
8243
8242
|
let i = [];
|
|
8244
8243
|
n > 0 && i.push(`${n} skipped - no changes`), r > 0 && i.push(`${r} already in requested destination`), t.length > 0 && i.push(`${t.length} failed`);
|
|
8245
|
-
let a =
|
|
8244
|
+
let a = Pi("Updated", e, {
|
|
8246
8245
|
context: i.length > 0 ? ` (${i.join(", ")})` : "",
|
|
8247
8246
|
showDetails: e.length <= 5
|
|
8248
8247
|
});
|
|
@@ -8250,35 +8249,35 @@ function gp({ tasks: e, failures: t, skippedCount: n, redundantMovesSkipped: r }
|
|
|
8250
8249
|
let o = t.slice(0, be.MAX_FAILURES_SHOWN), s = t.length - o.length, c = o.map((e) => ` ${e.item}: ${e.error}`).join("\n"), l = s > 0 ? `\n +${s} more` : "";
|
|
8251
8250
|
return `${a}\nFailed (${t.length}) - address or drop these items:\n${c}${l}`;
|
|
8252
8251
|
}
|
|
8253
|
-
function
|
|
8252
|
+
function vp({ id: e, replaceRecurrence: t, ...n }) {
|
|
8254
8253
|
return Object.keys(n).length > 0;
|
|
8255
8254
|
}
|
|
8256
|
-
function
|
|
8255
|
+
function yp(e, t, n) {
|
|
8257
8256
|
if (e === void 0) return e;
|
|
8258
8257
|
if (e === null) return n;
|
|
8259
8258
|
let r = e.trim().toLowerCase();
|
|
8260
8259
|
return t.includes(r) ? n : e;
|
|
8261
8260
|
}
|
|
8262
8261
|
// src/tools/update-template.ts
|
|
8263
|
-
var
|
|
8264
|
-
templateId: p.string().regex(
|
|
8262
|
+
var bp = {
|
|
8263
|
+
templateId: p.string().regex(wa).describe("A saved template ID (\"UT_28Ex...\") or its Todoist URL."),
|
|
8265
8264
|
name: p.string().trim().min(1).optional(),
|
|
8266
8265
|
description: p.string().trim().min(1).optional(),
|
|
8267
|
-
color:
|
|
8266
|
+
color: mi("Unrecognized colors are omitted. Omit to keep the current color."),
|
|
8268
8267
|
projectId: p.string().min(1).optional().describe("Replace the template's content with this project's current content."),
|
|
8269
8268
|
content: Mo.optional().describe("Replace the template's content: the `content` fetch-object returns for the template, with your edits, all of it. Anything left out is removed. Task IDs change on every save, so fetch the template again before each edit. Not with `projectId`."),
|
|
8270
8269
|
workspace: p.string().trim().min(1).optional().describe("Workspace name or ID to move a personal template into. A workspace template cannot move again."),
|
|
8271
8270
|
sharedWithWorkspaceMembers: p.boolean().optional().describe("Share a workspace template with its members, or stop sharing it. Only the author can change this.")
|
|
8272
|
-
},
|
|
8271
|
+
}, xp = {
|
|
8273
8272
|
templateId: p.string(),
|
|
8274
8273
|
name: p.string(),
|
|
8275
8274
|
workspaceId: p.string().optional().describe("Absent for personal templates."),
|
|
8276
8275
|
sharedWithWorkspaceMembers: p.boolean()
|
|
8277
|
-
},
|
|
8276
|
+
}, Sp = {
|
|
8278
8277
|
name: B.UPDATE_TEMPLATE,
|
|
8279
8278
|
description: "Update a saved Todoist template: rename it, change its description or color, edit its content (layout, sections, tasks, comments) or replace it from a project, move it into a workspace, or share it with workspace members. Omitted fields stay unchanged. Gallery templates cannot be edited.",
|
|
8280
|
-
parameters:
|
|
8281
|
-
outputSchema:
|
|
8279
|
+
parameters: bp,
|
|
8280
|
+
outputSchema: xp,
|
|
8282
8281
|
annotations: {
|
|
8283
8282
|
readOnlyHint: !1,
|
|
8284
8283
|
destructiveHint: !0,
|
|
@@ -8286,7 +8285,7 @@ var yp = {
|
|
|
8286
8285
|
openWorldHint: !0
|
|
8287
8286
|
},
|
|
8288
8287
|
async execute({ templateId: e, name: t, description: n, color: r, projectId: i, content: a, workspace: o, sharedWithWorkspaceMembers: s }, c) {
|
|
8289
|
-
let l =
|
|
8288
|
+
let l = Ea(e);
|
|
8290
8289
|
if (!l.startsWith("UT_")) throw Error(`"${l}" is not a saved template ID. Saved template IDs start with "UT_"; gallery templates cannot be edited.`);
|
|
8291
8290
|
if ([
|
|
8292
8291
|
t,
|
|
@@ -8298,7 +8297,7 @@ var yp = {
|
|
|
8298
8297
|
s
|
|
8299
8298
|
].every((e) => e === void 0)) throw Error("Nothing to update. Provide at least one field to change. An unrecognized color is ignored, so pass one of the listed colors.");
|
|
8300
8299
|
if (a && i) throw Error("Provide either `content` or `projectId`, not both: each replaces the whole content.");
|
|
8301
|
-
let u = a ? Io(a) : void 0, [d, f] = await Promise.all([u ?
|
|
8300
|
+
let u = a ? Io(a) : void 0, [d, f] = await Promise.all([u ? Cp(c, l, "before") : void 0, o ? sa.resolveWorkspace(c, o).then((e) => e.workspaceId) : void 0]), p = await c.updateTemplate(l, {
|
|
8302
8301
|
name: t,
|
|
8303
8302
|
description: n,
|
|
8304
8303
|
color: r,
|
|
@@ -8308,7 +8307,7 @@ var yp = {
|
|
|
8308
8307
|
sharedWithWorkspaceMembers: s
|
|
8309
8308
|
}), m = p.workspaceId ?? void 0, h = p.sharedWithWorkspaceMembers ?? !1, g = m ? ` It is in workspace (id=${m}) and ${h ? "shared with" : "not shared with"} its members.` : " It is a personal template.", _ = "";
|
|
8310
8309
|
if (u) {
|
|
8311
|
-
let e = await
|
|
8310
|
+
let e = await Cp(c, l, "after");
|
|
8312
8311
|
if (!e) _ = " The content was saved, but could not be read back to compare.";
|
|
8313
8312
|
else {
|
|
8314
8313
|
_ = d ? ` Content: ${Ro(d, e)}.` : " The previous content could not be read, so the change is not reported.";
|
|
@@ -8327,7 +8326,7 @@ var yp = {
|
|
|
8327
8326
|
};
|
|
8328
8327
|
}
|
|
8329
8328
|
};
|
|
8330
|
-
async function
|
|
8329
|
+
async function Cp(e, t, n) {
|
|
8331
8330
|
try {
|
|
8332
8331
|
return (await R(() => e.getTemplateContent(t))).content;
|
|
8333
8332
|
} catch (e) {
|
|
@@ -8336,7 +8335,7 @@ async function Sp(e, t, n) {
|
|
|
8336
8335
|
}
|
|
8337
8336
|
}
|
|
8338
8337
|
// src/tools/user-info.ts
|
|
8339
|
-
var
|
|
8338
|
+
var wp = {}, Tp = {
|
|
8340
8339
|
type: p.literal("user_info").describe("The type of the response."),
|
|
8341
8340
|
userId: p.string().describe("The user ID."),
|
|
8342
8341
|
fullName: p.string().describe("The full name of the user."),
|
|
@@ -8357,22 +8356,22 @@ var Cp = {}, wp = {
|
|
|
8357
8356
|
"Todoist Business"
|
|
8358
8357
|
]).describe("The user plan.")
|
|
8359
8358
|
};
|
|
8360
|
-
function
|
|
8359
|
+
function Ep(e) {
|
|
8361
8360
|
return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
|
|
8362
8361
|
}
|
|
8363
|
-
function
|
|
8362
|
+
function Dp(e, t) {
|
|
8364
8363
|
let n = ((e.getDay() || 7) - t + 7) % 7, r = new Date(e);
|
|
8365
8364
|
return r.setDate(e.getDate() - n), r;
|
|
8366
8365
|
}
|
|
8367
|
-
function
|
|
8366
|
+
function Op(e) {
|
|
8368
8367
|
let t = new Date(e);
|
|
8369
8368
|
return t.setDate(e.getDate() + 6), t;
|
|
8370
8369
|
}
|
|
8371
|
-
function
|
|
8370
|
+
function kp(e) {
|
|
8372
8371
|
let t = Date.UTC(e.getFullYear(), e.getMonth(), e.getDate() + 3), n = new Date(t).getUTCFullYear(), r = (t - Date.UTC(n, 0, 1)) / 864e5;
|
|
8373
8372
|
return Math.floor(r / 7) + 1;
|
|
8374
8373
|
}
|
|
8375
|
-
function
|
|
8374
|
+
function Ap(e) {
|
|
8376
8375
|
return [
|
|
8377
8376
|
"Sunday",
|
|
8378
8377
|
"Monday",
|
|
@@ -8383,18 +8382,18 @@ function kp(e) {
|
|
|
8383
8382
|
"Saturday"
|
|
8384
8383
|
][e === 7 ? 0 : e] ?? "Unknown";
|
|
8385
8384
|
}
|
|
8386
|
-
function
|
|
8385
|
+
function jp(e) {
|
|
8387
8386
|
try {
|
|
8388
8387
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
8389
8388
|
} catch {
|
|
8390
8389
|
return !1;
|
|
8391
8390
|
}
|
|
8392
8391
|
}
|
|
8393
|
-
function
|
|
8394
|
-
return
|
|
8392
|
+
function Mp(e) {
|
|
8393
|
+
return jp(e) ? e : "UTC";
|
|
8395
8394
|
}
|
|
8396
|
-
function
|
|
8397
|
-
let n =
|
|
8395
|
+
function Np(e, t) {
|
|
8396
|
+
let n = Mp(t);
|
|
8398
8397
|
return e.toLocaleString("en-US", {
|
|
8399
8398
|
timeZone: n,
|
|
8400
8399
|
year: "numeric",
|
|
@@ -8406,8 +8405,8 @@ function Mp(e, t) {
|
|
|
8406
8405
|
hour12: !1
|
|
8407
8406
|
});
|
|
8408
8407
|
}
|
|
8409
|
-
async function
|
|
8410
|
-
let t = await e.getUser(), n =
|
|
8408
|
+
async function Pp(e) {
|
|
8409
|
+
let t = await e.getUser(), n = Mp(t.tzInfo?.timezone ?? "UTC"), r = /* @__PURE__ */ new Date(), i = Np(r, n), a = t.startDay ?? 1, o = Ap(a), s = Ep(t), c = Dp(new Date(r.toLocaleString("en-US", { timeZone: n })), a), l = Op(c), u = kp(c);
|
|
8411
8410
|
return {
|
|
8412
8411
|
textContent: [
|
|
8413
8412
|
"# User Information",
|
|
@@ -8421,8 +8420,8 @@ async function Np(e) {
|
|
|
8421
8420
|
"## Week Settings",
|
|
8422
8421
|
`**Week Start Day:** ${o} (${a})`,
|
|
8423
8422
|
`**Current Week:** Week ${u}`,
|
|
8424
|
-
`**Week Start Date:** ${
|
|
8425
|
-
`**Week End Date:** ${
|
|
8423
|
+
`**Week Start Date:** ${Oi(c)}`,
|
|
8424
|
+
`**Week End Date:** ${Oi(l)}`,
|
|
8426
8425
|
"",
|
|
8427
8426
|
"## Daily Progress",
|
|
8428
8427
|
`**Completed Today:** ${t.completedToday}`,
|
|
@@ -8440,8 +8439,8 @@ async function Np(e) {
|
|
|
8440
8439
|
currentLocalTime: i,
|
|
8441
8440
|
startDay: a,
|
|
8442
8441
|
startDayName: o,
|
|
8443
|
-
weekStartDate:
|
|
8444
|
-
weekEndDate:
|
|
8442
|
+
weekStartDate: Oi(c),
|
|
8443
|
+
weekEndDate: Oi(l),
|
|
8445
8444
|
currentWeekNumber: u,
|
|
8446
8445
|
completedToday: t.completedToday,
|
|
8447
8446
|
dailyGoal: t.dailyGoal,
|
|
@@ -8451,30 +8450,30 @@ async function Np(e) {
|
|
|
8451
8450
|
}
|
|
8452
8451
|
};
|
|
8453
8452
|
}
|
|
8454
|
-
var
|
|
8453
|
+
var Fp = {
|
|
8455
8454
|
name: B.USER_INFO,
|
|
8456
8455
|
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).",
|
|
8457
|
-
parameters:
|
|
8458
|
-
outputSchema:
|
|
8456
|
+
parameters: wp,
|
|
8457
|
+
outputSchema: Tp,
|
|
8459
8458
|
annotations: {
|
|
8460
8459
|
readOnlyHint: !0,
|
|
8461
8460
|
destructiveHint: !1,
|
|
8462
8461
|
idempotentHint: !0
|
|
8463
8462
|
},
|
|
8464
8463
|
async execute(e, t) {
|
|
8465
|
-
let n = await
|
|
8464
|
+
let n = await Pp(t);
|
|
8466
8465
|
return {
|
|
8467
8466
|
textContent: n.textContent,
|
|
8468
8467
|
structuredContent: n.structuredContent
|
|
8469
8468
|
};
|
|
8470
8469
|
}
|
|
8471
|
-
},
|
|
8470
|
+
}, Ip = 10485760, Lp = /* @__PURE__ */ new Set([
|
|
8472
8471
|
"image/png",
|
|
8473
8472
|
"image/jpeg",
|
|
8474
8473
|
"image/gif",
|
|
8475
8474
|
"image/webp",
|
|
8476
8475
|
"image/svg+xml"
|
|
8477
|
-
]),
|
|
8476
|
+
]), Rp = /* @__PURE__ */ new Set([
|
|
8478
8477
|
"text/plain",
|
|
8479
8478
|
"text/csv",
|
|
8480
8479
|
"text/html",
|
|
@@ -8482,7 +8481,7 @@ var Pp = {
|
|
|
8482
8481
|
"application/json",
|
|
8483
8482
|
"application/xml",
|
|
8484
8483
|
"text/xml"
|
|
8485
|
-
]),
|
|
8484
|
+
]), zp = {
|
|
8486
8485
|
".png": "image/png",
|
|
8487
8486
|
".jpg": "image/jpeg",
|
|
8488
8487
|
".jpeg": "image/jpeg",
|
|
@@ -8497,21 +8496,21 @@ var Pp = {
|
|
|
8497
8496
|
".xml": "application/xml",
|
|
8498
8497
|
".pdf": "application/pdf"
|
|
8499
8498
|
};
|
|
8500
|
-
function zp(e) {
|
|
8501
|
-
return Ip.has(e) ? "image" : Lp.has(e) || e.startsWith("text/") ? "text" : "binary";
|
|
8502
|
-
}
|
|
8503
8499
|
function Bp(e) {
|
|
8504
|
-
return (e
|
|
8500
|
+
return Lp.has(e) ? "image" : Rp.has(e) || e.startsWith("text/") ? "text" : "binary";
|
|
8505
8501
|
}
|
|
8506
8502
|
function Vp(e) {
|
|
8503
|
+
return (e.split(";")[0] ?? e).trim().toLowerCase();
|
|
8504
|
+
}
|
|
8505
|
+
function Hp(e) {
|
|
8507
8506
|
try {
|
|
8508
8507
|
let t = new URL(e).pathname, n = t.lastIndexOf(".");
|
|
8509
|
-
return n === -1 ? void 0 :
|
|
8508
|
+
return n === -1 ? void 0 : zp[t.slice(n).toLowerCase()];
|
|
8510
8509
|
} catch {
|
|
8511
8510
|
return;
|
|
8512
8511
|
}
|
|
8513
8512
|
}
|
|
8514
|
-
function
|
|
8513
|
+
function Up(e) {
|
|
8515
8514
|
try {
|
|
8516
8515
|
let t = new URL(e).pathname, n = t.lastIndexOf("/");
|
|
8517
8516
|
return n === -1 ? void 0 : t.slice(n + 1) || void 0;
|
|
@@ -8519,21 +8518,21 @@ function Hp(e) {
|
|
|
8519
8518
|
return;
|
|
8520
8519
|
}
|
|
8521
8520
|
}
|
|
8522
|
-
var
|
|
8521
|
+
var Wp = { fileUrl: p.url().regex(/^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl\.cloudfront\.net)\/\S*$/, { error: "Pass the fileUrl from a comment's fileAttachment: an https URL on files.todoist.com, todoist.b-cdn.net or d1ysz50cxb9zwl.cloudfront.net." }).describe("The fileUrl from a comment's fileAttachment. Allowed hosts (https only): files.todoist.com, todoist.b-cdn.net, d1ysz50cxb9zwl.cloudfront.net.") }, Gp = {
|
|
8523
8522
|
name: B.VIEW_ATTACHMENT,
|
|
8524
8523
|
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).",
|
|
8525
|
-
parameters:
|
|
8524
|
+
parameters: Wp,
|
|
8526
8525
|
annotations: {
|
|
8527
8526
|
readOnlyHint: !0,
|
|
8528
8527
|
destructiveHint: !1,
|
|
8529
8528
|
idempotentHint: !0
|
|
8530
8529
|
},
|
|
8531
8530
|
async execute({ fileUrl: e }, t) {
|
|
8532
|
-
let n = await t.viewAttachment(e), r = n.headers["content-length"], i = r ? Number.parseInt(r, 10) : void 0, a =
|
|
8533
|
-
if (i && i >
|
|
8531
|
+
let n = await t.viewAttachment(e), r = n.headers["content-length"], i = r ? Number.parseInt(r, 10) : void 0, a = Up(e), o = n.headers["content-type"], s = o ? Vp(o) : void 0, c = s && s !== "application/octet-stream" ? s : Hp(e) ?? s ?? "application/octet-stream";
|
|
8532
|
+
if (i && i > Ip) return { textContent: `Attachment "${a ?? e}" is too large to display inline (${(i / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${c}` };
|
|
8534
8533
|
let l = Buffer.from(await n.arrayBuffer()), u = l.byteLength;
|
|
8535
|
-
if (u >
|
|
8536
|
-
let d =
|
|
8534
|
+
if (u > Ip) return { textContent: `Attachment "${a ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${c}` };
|
|
8535
|
+
let d = Bp(c), f = [];
|
|
8537
8536
|
return d === "image" ? f.push({
|
|
8538
8537
|
type: "image",
|
|
8539
8538
|
data: l.toString("base64"),
|
|
@@ -8553,42 +8552,42 @@ var Up = { fileUrl: p.url().regex(/^https:\/\/(?:files\.todoist\.com|todoist\.b-
|
|
|
8553
8552
|
contentItems: f
|
|
8554
8553
|
};
|
|
8555
8554
|
}
|
|
8556
|
-
},
|
|
8555
|
+
}, Kp = {
|
|
8557
8556
|
addTasks: xo,
|
|
8558
8557
|
completeTasks: ns,
|
|
8559
|
-
uncompleteTasks:
|
|
8560
|
-
updateTasks:
|
|
8561
|
-
rescheduleTasks:
|
|
8558
|
+
uncompleteTasks: Yd,
|
|
8559
|
+
updateTasks: sp,
|
|
8560
|
+
rescheduleTasks: Dd,
|
|
8562
8561
|
findTasks: jl,
|
|
8563
8562
|
findTasksByDate: {
|
|
8564
8563
|
...vl,
|
|
8565
8564
|
_meta: { ui: { resourceUri: ke } }
|
|
8566
8565
|
},
|
|
8567
8566
|
findCompletedTasks: gc,
|
|
8568
|
-
addProjects:
|
|
8569
|
-
updateProjects:
|
|
8567
|
+
addProjects: Fa,
|
|
8568
|
+
updateProjects: kf,
|
|
8570
8569
|
findProjects: Jc,
|
|
8571
|
-
projectManagement:
|
|
8572
|
-
projectMove:
|
|
8573
|
-
addFolders:
|
|
8574
|
-
updateFolders:
|
|
8570
|
+
projectManagement: Zu,
|
|
8571
|
+
projectMove: td,
|
|
8572
|
+
addFolders: ma,
|
|
8573
|
+
updateFolders: mf,
|
|
8575
8574
|
findFolders: wc,
|
|
8576
|
-
addSections:
|
|
8577
|
-
updateSections:
|
|
8575
|
+
addSections: mo,
|
|
8576
|
+
updateSections: Hf,
|
|
8578
8577
|
findSections: ll,
|
|
8579
|
-
addComments:
|
|
8578
|
+
addComments: Wi,
|
|
8580
8579
|
findComments: rc,
|
|
8581
|
-
updateComments:
|
|
8582
|
-
addReminders:
|
|
8580
|
+
updateComments: tf,
|
|
8581
|
+
addReminders: co,
|
|
8583
8582
|
findReminders: nl,
|
|
8584
|
-
updateReminders:
|
|
8585
|
-
viewAttachment:
|
|
8586
|
-
addLabels:
|
|
8587
|
-
updateLabels:
|
|
8583
|
+
updateReminders: Rf,
|
|
8584
|
+
viewAttachment: Gp,
|
|
8585
|
+
addLabels: ya,
|
|
8586
|
+
updateLabels: Sf,
|
|
8588
8587
|
findLabels: kc,
|
|
8589
|
-
findFilters:
|
|
8590
|
-
addFilters:
|
|
8591
|
-
updateFilters:
|
|
8588
|
+
findFilters: $i,
|
|
8589
|
+
addFilters: ia,
|
|
8590
|
+
updateFilters: sf,
|
|
8592
8591
|
findActivity: Ks,
|
|
8593
8592
|
getProductivityStats: ou,
|
|
8594
8593
|
getProjectHealth: hu,
|
|
@@ -8598,32 +8597,32 @@ var Up = { fileUrl: p.url().regex(/^https:\/\/(?:files\.todoist\.com|todoist\.b-
|
|
|
8598
8597
|
getOverview: tu,
|
|
8599
8598
|
deleteObject: ys,
|
|
8600
8599
|
fetchObject: Ls,
|
|
8601
|
-
reorderObjects:
|
|
8602
|
-
userInfo:
|
|
8600
|
+
reorderObjects: pd,
|
|
8601
|
+
userInfo: Fp,
|
|
8603
8602
|
getUserStatus: Su,
|
|
8604
|
-
setUserStatus:
|
|
8603
|
+
setUserStatus: Kd,
|
|
8605
8604
|
findProjectCollaborators: Ic,
|
|
8606
|
-
manageAssignments:
|
|
8605
|
+
manageAssignments: Gu,
|
|
8607
8606
|
exportProject: ws,
|
|
8608
8607
|
importIntoProject: Mu,
|
|
8609
8608
|
addTemplate: Ko,
|
|
8610
8609
|
findTemplates: zl,
|
|
8611
|
-
updateTemplate:
|
|
8610
|
+
updateTemplate: Sp,
|
|
8612
8611
|
listWorkspaces: Lu,
|
|
8613
|
-
search:
|
|
8612
|
+
search: Fd,
|
|
8614
8613
|
fetch: Vs
|
|
8615
|
-
},
|
|
8616
|
-
function
|
|
8614
|
+
}, qp = Object.values(Kp), Jp = "\n## Todoist\n\nManage Todoist: tasks (priorities, dates, durations, assignees, labels); projects, sections and folders, personal or in workspaces; comments and attachments, filters, reminders, templates, collaborators, user status, activity, overviews and productivity stats.\n\n**Dates**\n\n- To move a task to a different date or time use **reschedule-tasks**, never **update-tasks**. It also sets duration, for time-blocking. update-tasks replaces the whole due string, so it refuses a dueString on a recurring task unless replaceRecurrence is true.\n- Never send a task's existing projectId, sectionId or parentId back to **update-tasks** — those fields are treated as a move.\n- All dates respect the user's timezone.\n- Todoist apps hide durations of 24 hours or more (\"36h\", \"3d\"): only set one when the user explicitly asks for it.\n\n**Finding things**\n\n- For \"what did I complete?\", call **user-info** for the asker's user ID, then **find-activity** with objectType=\"task\", eventType=\"completed\", initiatorId, and dateFrom/dateTo. Without initiatorId the answer covers every collaborator. find-activity reports completion events, including each occurrence of a recurring task; **find-completed-tasks** lists completed tasks, which is not the same question.\n- To resolve a person's name or email to a user ID, or to answer \"who is X?\", use **find-project-collaborators** with just a searchTerm. It covers every shared project you can access plus yourself, so an empty result means they share none of them, not that they do not exist.\n- Before assigning work, call **find-project-collaborators** again with the target projectId: an ID only proves they share *some* project with you, and assignment needs that one.\n- To check whether a task has subtasks, use **fetch-object** with includeChildren, not a speculative **find-tasks**.\n- Filter tasks by label **name**. Label IDs are only for **delete-object** and **update-labels**. Shared labels can be renamed but not recoloured, reordered or favourited.\n\n**Comments**\n\n- Comments notify only the people **add-comments** is handed. When a comment mentions someone, name them in `notifyUsers` — writing \"@Ana\" in the text notifies nobody. Omit `notifyUsers` to notify whoever the Todoist apps would, or pass `[\"none\"]` to stay silent.\n- Editing a comment cannot notify anyone; only adding one can.\n\n**Deleting and archiving**\n\n- **delete-object** removes every object type, \"reminder\" and \"location_reminder\" included; there is no per-type delete tool.\n- A workspace project must be archived with **project-management** before it can be deleted. A personal project can be deleted directly.\n\n**Templates**\n\n- Use **find-templates** when the user names a template without its ID or URL. Start a project from one with **add-projects** and its templateId, or add one to an existing project with **import-into-project**; both write immediately and cannot be undone.\n- **add-template** saves a reusable template from a project (\"Save as template\"), CSV or scratch; **export-project** returns a CSV instead. Edit, move or share a saved template with **update-template**; to change its layout, sections or tasks, read it with **fetch-object** first, then send the edited content to **update-template**.\n\n**Project health**\n\n- Health data may be stale: if isStale is true, call **analyze-project-health** to refresh it before reading again.\n\n**Batches**\n\n- Prefer a batch tool over one call per item.\n- Per-item `failures` from a batch tool don't undo the rest: never retry the whole batch, re-send only the failed items whose reason is fixable.\n\nFor a productivity review, call **get-productivity-stats**, then find what the user completed as described under \"Finding things\".\n\n**Other Todoist apps**\n\n- Todoist Automations (workflows on a schedule or trigger, such as a new project, that can ask the user questions; Pro and Business plans) and Comms (team chat) are separate MCP servers on the same Todoist account: https://ai.todoist.net/mcp/automations and https://ai.todoist.net/mcp/comms. Never say one has no MCP support: tell the user they can add it.\n", Yp = "The official Todoist MCP server. Add, update, schedule, complete and search tasks, with priorities, due dates, deadlines, durations, labels and assignees. Organise projects, sections and folders, personal or in a workspace. Add, edit and read comments and view their attachments, and manage labels, saved filters, reminders and templates. Find collaborators, check or set your status, and review activity, project health and productivity stats.";
|
|
8615
|
+
function Xp({ token: e, baseUrl: n, features: r = [] }) {
|
|
8617
8616
|
let i = new t({
|
|
8618
8617
|
name: "todoist-mcp-server",
|
|
8619
8618
|
version: zt,
|
|
8620
|
-
description:
|
|
8619
|
+
description: Yp
|
|
8621
8620
|
}, {
|
|
8622
8621
|
capabilities: {
|
|
8623
8622
|
tools: { listChanged: !0 },
|
|
8624
8623
|
prompts: { listChanged: !0 }
|
|
8625
8624
|
},
|
|
8626
|
-
instructions:
|
|
8625
|
+
instructions: Jp,
|
|
8627
8626
|
cacheHints: {
|
|
8628
8627
|
"server/discover": ye,
|
|
8629
8628
|
"tools/list": ye,
|
|
@@ -8633,7 +8632,7 @@ function Yp({ token: e, baseUrl: n, features: r = [] }) {
|
|
|
8633
8632
|
}
|
|
8634
8633
|
}), a = rn(e, { baseUrl: n });
|
|
8635
8634
|
return Ie(i), On({
|
|
8636
|
-
tools:
|
|
8635
|
+
tools: qp,
|
|
8637
8636
|
server: i,
|
|
8638
8637
|
client: a,
|
|
8639
8638
|
features: r
|
|
@@ -8643,4 +8642,4 @@ function Yp({ token: e, baseUrl: n, features: r = [] }) {
|
|
|
8643
8642
|
argsSchema: Jn.argsSchema
|
|
8644
8643
|
}, (e) => Jn.callback(e, a)), i;
|
|
8645
8644
|
}
|
|
8646
|
-
export {
|
|
8645
|
+
export { Fa as $, tu as A, gc as B, Lu as C, hu as D, Su as E, nl as F, ws as G, Ks as H, Jc as I, $o as J, ys as K, Ic as L, jl as M, vl as N, du as O, ll as P, co as Q, kc as R, Gu as S, Eu as T, Vs as U, rc as V, Ls as W, xo as X, Ko as Y, mo as Z, Fd as _, Fp as a, yn as at, td as b, Hf as c, Sf as d, ya as et, mf as f, Kd as g, Yd as h, Gp as i, Wi as it, zl as j, ou as k, Rf as l, tf as m, qp as n, ia as nt, Sp as o, qt as ot, sf as p, ns as q, Kp as r, $i as rt, sp as s, en as st, Xp as t, ma as tt, kf as u, Dd as v, Mu as w, Zu as x, pd as y, wc as z };
|