@todoist/mcp 19.3.1 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +18 -18
- package/dist/index.js +2 -2
- package/dist/main-http.js +2 -2
- package/dist/main.js +1 -1
- package/dist/{mcp-server-CICPv9x5.js → mcp-server-evoO2bJn.js} +781 -761
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/{require-valid-todoist-token-CQsGtsXK.js → require-valid-todoist-token-a9fHse9A.js} +1 -1
- package/dist/tool-registry.d.ts +18 -18
- package/dist/tools/add-template.d.ts +9 -9
- package/dist/tools/fetch-object.d.ts +3 -3
- package/dist/tools/update-template.d.ts +6 -6
- package/dist/utils/template-content.d.ts +3 -3
- package/dist/utils/template-content.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: "
|
|
354
|
+
version: "20.1.0",
|
|
355
355
|
type: "module",
|
|
356
356
|
main: "./dist/index.js",
|
|
357
357
|
types: "./dist/index.d.ts",
|
|
@@ -3340,7 +3340,7 @@ var Ao = p.object({
|
|
|
3340
3340
|
content: p.string(),
|
|
3341
3341
|
postedUid: p.string().optional(),
|
|
3342
3342
|
postedAt: p.string().optional(),
|
|
3343
|
-
fileAttachment: p.
|
|
3343
|
+
fileAttachment: p.string().optional().describe("JSON. Send back as received.")
|
|
3344
3344
|
}, Mo = p.object({
|
|
3345
3345
|
projects: p.array(p.object({
|
|
3346
3346
|
viewStyle: p.enum(x),
|
|
@@ -3374,7 +3374,7 @@ var Ao = p.object({
|
|
|
3374
3374
|
...jo
|
|
3375
3375
|
})).max(Se.ITEMS),
|
|
3376
3376
|
projectComments: p.array(p.object(jo)).max(Se.ITEMS),
|
|
3377
|
-
projectViewOptionsDefaults: p.array(p.
|
|
3377
|
+
projectViewOptionsDefaults: p.array(p.string()).max(Se.PROJECT_VIEW_OPTIONS).describe("Calendar settings, each as JSON. Send back as received.")
|
|
3378
3378
|
});
|
|
3379
3379
|
function No(e) {
|
|
3380
3380
|
return {
|
|
@@ -3407,7 +3407,7 @@ function No(e) {
|
|
|
3407
3407
|
...Fo(t)
|
|
3408
3408
|
})),
|
|
3409
3409
|
projectComments: e.projectComments.map(Fo),
|
|
3410
|
-
projectViewOptionsDefaults: e.projectViewOptionsDefaults
|
|
3410
|
+
projectViewOptionsDefaults: e.projectViewOptionsDefaults.map((e) => JSON.stringify(e))
|
|
3411
3411
|
};
|
|
3412
3412
|
}
|
|
3413
3413
|
function Po(e) {
|
|
@@ -3424,19 +3424,39 @@ function Fo(e) {
|
|
|
3424
3424
|
content: e.content,
|
|
3425
3425
|
postedUid: e.postedUid ?? void 0,
|
|
3426
3426
|
postedAt: e.postedAt ?? void 0,
|
|
3427
|
-
fileAttachment: e.fileAttachment
|
|
3427
|
+
fileAttachment: e.fileAttachment ? JSON.stringify(e.fileAttachment) : void 0
|
|
3428
3428
|
};
|
|
3429
3429
|
}
|
|
3430
|
-
function Io(e) {
|
|
3430
|
+
function Io(e, t) {
|
|
3431
|
+
let n;
|
|
3432
|
+
try {
|
|
3433
|
+
n = JSON.parse(e);
|
|
3434
|
+
} catch {
|
|
3435
|
+
n = void 0;
|
|
3436
|
+
}
|
|
3437
|
+
if (typeof n != "object" || !n || Array.isArray(n)) throw Error(`${t} must be the JSON object fetch-object returned, sent back unchanged. Nothing was saved.`);
|
|
3438
|
+
return n;
|
|
3439
|
+
}
|
|
3440
|
+
function Lo(e, t) {
|
|
3441
|
+
let { fileAttachment: n, ...r } = e;
|
|
3442
|
+
return n === void 0 ? r : {
|
|
3443
|
+
...r,
|
|
3444
|
+
fileAttachment: Io(n, t)
|
|
3445
|
+
};
|
|
3446
|
+
}
|
|
3447
|
+
function Ro(e) {
|
|
3431
3448
|
return {
|
|
3432
3449
|
...e,
|
|
3433
3450
|
tasks: e.tasks.map(({ priority: e, ...t }) => ({
|
|
3434
3451
|
...t,
|
|
3435
3452
|
...e ? { priority: cr(e) } : {}
|
|
3436
|
-
}))
|
|
3453
|
+
})),
|
|
3454
|
+
comments: e.comments.map((e, t) => Lo(e, `comments[${t}].fileAttachment`)),
|
|
3455
|
+
projectComments: e.projectComments.map((e, t) => Lo(e, `projectComments[${t}].fileAttachment`)),
|
|
3456
|
+
projectViewOptionsDefaults: e.projectViewOptionsDefaults.map((e, t) => Io(e, `projectViewOptionsDefaults[${t}]`))
|
|
3437
3457
|
};
|
|
3438
3458
|
}
|
|
3439
|
-
function
|
|
3459
|
+
function zo(e) {
|
|
3440
3460
|
return [
|
|
3441
3461
|
["sections", e.sections.length],
|
|
3442
3462
|
["tasks", e.tasks.length],
|
|
@@ -3444,27 +3464,27 @@ function Lo(e) {
|
|
|
3444
3464
|
["comments", e.comments.length + e.projectComments.length]
|
|
3445
3465
|
];
|
|
3446
3466
|
}
|
|
3447
|
-
function
|
|
3448
|
-
let n = (e) => e.projects[0]?.viewStyle ?? "none", r =
|
|
3449
|
-
return [`layout ${n(e)} → ${n(t)}`, ...
|
|
3467
|
+
function Bo(e, t) {
|
|
3468
|
+
let n = (e) => e.projects[0]?.viewStyle ?? "none", r = zo(t);
|
|
3469
|
+
return [`layout ${n(e)} → ${n(t)}`, ...zo(e).map(([e, t], n) => `${e} ${t} → ${r[n]?.[1]}`)].join(", ");
|
|
3450
3470
|
}
|
|
3451
|
-
function
|
|
3452
|
-
let n =
|
|
3471
|
+
function Vo(e, t) {
|
|
3472
|
+
let n = zo(t), r = zo(e).flatMap(([e, t], r) => {
|
|
3453
3473
|
let i = n[r]?.[1] ?? 0;
|
|
3454
3474
|
return i < t ? [`${e} sent ${t}, saved ${i}`] : [];
|
|
3455
3475
|
});
|
|
3456
3476
|
return r.length > 0 ? r.join("; ") : void 0;
|
|
3457
3477
|
}
|
|
3458
|
-
var
|
|
3459
|
-
function
|
|
3460
|
-
let t = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, n = e.projects[0]?.viewStyle ?? "list", r = new Map(e.sections.map((e) => [e.id, e.name])), i = [`${n} layout, ${t(e.sections.length, "section")}, ${t(e.tasks.length, "task")}.`, ...e.tasks.slice(0,
|
|
3478
|
+
var Ho = 20;
|
|
3479
|
+
function Uo(e) {
|
|
3480
|
+
let t = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, n = e.projects[0]?.viewStyle ?? "list", r = new Map(e.sections.map((e) => [e.id, e.name])), i = [`${n} layout, ${t(e.sections.length, "section")}, ${t(e.tasks.length, "task")}.`, ...e.tasks.slice(0, Ho).map((e) => {
|
|
3461
3481
|
let t = e.parentId ? " " : "", n = e.sectionId ? ` [${r.get(e.sectionId) ?? e.sectionId}]` : "", i = e.due?.string ? ` (due ${e.due.string})` : "";
|
|
3462
3482
|
return `${t}- ${e.content}${n}${i}`;
|
|
3463
|
-
})], a = e.tasks.length -
|
|
3483
|
+
})], a = e.tasks.length - Ho;
|
|
3464
3484
|
return a > 0 && i.push(`… ${t(a, "more task")} in the full content.`), i.join("\n");
|
|
3465
3485
|
}
|
|
3466
3486
|
// src/tools/add-template.ts
|
|
3467
|
-
var
|
|
3487
|
+
var Wo = {
|
|
3468
3488
|
projectId: p.string().min(1).optional().describe("Start from this project, like the app's \"Save as template\". It is copied, not changed."),
|
|
3469
3489
|
csvFileContent: p.string().min(1).optional().describe("Start from this CSV, e.g. from export-project or a file the user shared. Not with projectId."),
|
|
3470
3490
|
preview: p.boolean().optional().describe("Defaults to true: return the draft without saving (blank, or from the project or CSV), to show the user and edit it first. Pass false only once the user has seen the draft, or asked to save as is."),
|
|
@@ -3474,24 +3494,24 @@ var Ho = {
|
|
|
3474
3494
|
color: pi("Unrecognized colors are omitted. Defaults to the project's color, or charcoal."),
|
|
3475
3495
|
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
3496
|
sharedWithWorkspaceMembers: p.boolean().optional().describe("Share a workspace template with the workspace's members. Defaults to false.")
|
|
3477
|
-
},
|
|
3497
|
+
}, Go = {
|
|
3478
3498
|
templateId: p.string().optional().describe("Absent for a draft."),
|
|
3479
3499
|
name: p.string().optional(),
|
|
3480
3500
|
workspaceId: p.string().optional().describe("Absent for personal templates."),
|
|
3481
3501
|
workspaceError: p.string().optional().describe("Set when the template was created but moving or sharing it failed."),
|
|
3482
3502
|
content: p.record(p.string(), p.unknown()).optional().describe("The draft. Edit it and send it back as `content` to save it.")
|
|
3483
|
-
},
|
|
3503
|
+
}, Ko = {
|
|
3484
3504
|
projects: [{ viewStyle: "list" }],
|
|
3485
3505
|
sections: [],
|
|
3486
3506
|
tasks: [],
|
|
3487
3507
|
comments: [],
|
|
3488
3508
|
projectComments: [],
|
|
3489
3509
|
projectViewOptionsDefaults: []
|
|
3490
|
-
},
|
|
3510
|
+
}, qo = "Before saving, show the user the draft and ask whether to change anything. Then call add-template again with preview: false, a name and description,", Jo = {
|
|
3491
3511
|
name: B.ADD_TEMPLATE,
|
|
3492
3512
|
description: "Create a reusable template in the user's Todoist: from a project, like the app's \"Save as template\"; from CSV content; or from scratch, starting from a blank draft. By default it only returns the draft. Show it to the user and ask whether to change anything, even when they described the whole template, unless they asked to save as is. Then save with preview: false, and `content` if it was edited. Each save creates a new template, which cannot be deleted here.",
|
|
3493
|
-
parameters:
|
|
3494
|
-
outputSchema:
|
|
3513
|
+
parameters: Wo,
|
|
3514
|
+
outputSchema: Go,
|
|
3495
3515
|
annotations: {
|
|
3496
3516
|
readOnlyHint: !1,
|
|
3497
3517
|
destructiveHint: !1,
|
|
@@ -3502,7 +3522,7 @@ var Ho = {
|
|
|
3502
3522
|
let { projectId: n, csvFileContent: r, preview: i, content: a } = e;
|
|
3503
3523
|
if (n && r) throw Error("Start from a project or from a CSV, not both. Nothing was saved.");
|
|
3504
3524
|
let o = r ? new Blob([r], { type: "text/csv" }) : void 0;
|
|
3505
|
-
if (i !== !1) return
|
|
3525
|
+
if (i !== !1) return Yo({
|
|
3506
3526
|
client: t,
|
|
3507
3527
|
projectId: n,
|
|
3508
3528
|
file: o,
|
|
@@ -3512,7 +3532,7 @@ var Ho = {
|
|
|
3512
3532
|
if (!n && !o && !a) throw Error("Nothing to save: pass `content`, or start from a `projectId` or `csvFileContent`.");
|
|
3513
3533
|
if (e.sharedWithWorkspaceMembers && !e.workspace) throw Error("Sharing needs `workspace`: only a workspace template can be shared with its members. Nothing was saved.");
|
|
3514
3534
|
if (!e.name || !e.description) throw Error("A name and a description are required to save the template. Leave out `preview` to see the draft first.");
|
|
3515
|
-
return
|
|
3535
|
+
return Xo(t, {
|
|
3516
3536
|
...e,
|
|
3517
3537
|
name: e.name,
|
|
3518
3538
|
description: e.description,
|
|
@@ -3520,15 +3540,15 @@ var Ho = {
|
|
|
3520
3540
|
});
|
|
3521
3541
|
}
|
|
3522
3542
|
};
|
|
3523
|
-
async function
|
|
3543
|
+
async function Yo({ client: e, projectId: t, file: n, content: r }) {
|
|
3524
3544
|
if (r) return {
|
|
3525
|
-
textContent: `Template draft, not saved: ${
|
|
3545
|
+
textContent: `Template draft, not saved: ${Uo(r)}\n${qo} and this \`content\`.`,
|
|
3526
3546
|
structuredContent: { content: r }
|
|
3527
3547
|
};
|
|
3528
3548
|
if (t) {
|
|
3529
3549
|
let n = No((await e.previewProjectAsTemplate(t)).content);
|
|
3530
3550
|
return {
|
|
3531
|
-
textContent: `Draft of project (id=${t}) as a template, not saved: ${
|
|
3551
|
+
textContent: `Draft of project (id=${t}) as a template, not saved: ${Uo(n)}\n${qo} and the edited \`content\` if it changed.`,
|
|
3532
3552
|
structuredContent: { content: n }
|
|
3533
3553
|
};
|
|
3534
3554
|
}
|
|
@@ -3538,20 +3558,20 @@ async function qo({ client: e, projectId: t, file: n, content: r }) {
|
|
|
3538
3558
|
fileName: "template.csv"
|
|
3539
3559
|
})).content);
|
|
3540
3560
|
return {
|
|
3541
|
-
textContent: `Draft of the CSV as a template, not saved: ${
|
|
3561
|
+
textContent: `Draft of the CSV as a template, not saved: ${Uo(t)}\n${qo} and either the CSV or the edited \`content\`.`,
|
|
3542
3562
|
structuredContent: { content: t }
|
|
3543
3563
|
};
|
|
3544
3564
|
}
|
|
3545
3565
|
return {
|
|
3546
|
-
textContent: `Blank template draft, not saved: ${
|
|
3547
|
-
structuredContent: { content:
|
|
3566
|
+
textContent: `Blank template draft, not saved: ${Uo(Ko)}\nAdd sections and tasks to its \`content\`. ${qo} and the \`content\`.`,
|
|
3567
|
+
structuredContent: { content: Ko }
|
|
3548
3568
|
};
|
|
3549
3569
|
}
|
|
3550
|
-
async function
|
|
3551
|
-
let [l, u] = await Promise.all([s ? oa.resolveWorkspace(e, s).then((e) => e.workspaceId) : void 0, t && (!o || s) ? G(e, t) : void 0]), d = r ?
|
|
3570
|
+
async function Xo(e, { projectId: t, file: n, content: r, name: i, description: a, color: o, workspace: s, sharedWithWorkspaceMembers: c }) {
|
|
3571
|
+
let [l, u] = await Promise.all([s ? oa.resolveWorkspace(e, s).then((e) => e.workspaceId) : void 0, t && (!o || s) ? G(e, t) : void 0]), d = r ? Ro(r) : void 0, f;
|
|
3552
3572
|
if (t) {
|
|
3553
3573
|
let n = u && E(u) ? u.workspaceId : void 0;
|
|
3554
|
-
f = await
|
|
3574
|
+
f = await Qo(() => e.saveProjectAsTemplate({
|
|
3555
3575
|
projectId: t,
|
|
3556
3576
|
name: i,
|
|
3557
3577
|
description: a,
|
|
@@ -3565,7 +3585,7 @@ async function Jo(e, { projectId: t, file: n, content: r, name: i, description:
|
|
|
3565
3585
|
fileName: "template.csv"
|
|
3566
3586
|
} : void 0;
|
|
3567
3587
|
if (!t) throw Error("Nothing to save: pass `content`, or start from a `projectId` or `csvFileContent`.");
|
|
3568
|
-
f = await
|
|
3588
|
+
f = await Qo(() => e.addTemplate({
|
|
3569
3589
|
...t,
|
|
3570
3590
|
name: i,
|
|
3571
3591
|
description: a,
|
|
@@ -3583,7 +3603,7 @@ async function Jo(e, { projectId: t, file: n, content: r, name: i, description:
|
|
|
3583
3603
|
}
|
|
3584
3604
|
let g = f.workspaceId ?? void 0;
|
|
3585
3605
|
return {
|
|
3586
|
-
textContent:
|
|
3606
|
+
textContent: Zo({
|
|
3587
3607
|
source: t ? `project (id=${t})` : r ? "the draft" : "CSV content",
|
|
3588
3608
|
template: f,
|
|
3589
3609
|
workspaceId: g,
|
|
@@ -3597,11 +3617,11 @@ async function Jo(e, { projectId: t, file: n, content: r, name: i, description:
|
|
|
3597
3617
|
}
|
|
3598
3618
|
};
|
|
3599
3619
|
}
|
|
3600
|
-
function
|
|
3620
|
+
function Zo({ source: e, template: t, workspaceId: n, workspaceError: r }) {
|
|
3601
3621
|
let i = `Created template "${t.name}" (id=${t.id}) from ${e}.`, a = t.sharedWithWorkspaceMembers ? "shared with members" : "not yet shared with members";
|
|
3602
3622
|
return `${i}${n ? ` It is in the workspace's templates (workspace id=${n}), ${a}.` : " It is in your personal templates."}${r ? ` Moving it into the workspace or sharing it failed: ${r}. Retry with update-template.` : ""} Use add-projects with this templateId to start a new project from it.`;
|
|
3603
3623
|
}
|
|
3604
|
-
async function
|
|
3624
|
+
async function Qo(e) {
|
|
3605
3625
|
try {
|
|
3606
3626
|
return await e();
|
|
3607
3627
|
} catch (e) {
|
|
@@ -3610,7 +3630,7 @@ async function Xo(e) {
|
|
|
3610
3630
|
}
|
|
3611
3631
|
}
|
|
3612
3632
|
// src/tools/analyze-project-health.ts
|
|
3613
|
-
var
|
|
3633
|
+
var $o = { projectId: p.string().min(1).describe("The ID of the project to analyze. This triggers a new health analysis which may take some time to complete.") }, es = {
|
|
3614
3634
|
projectId: p.string().describe("The project ID."),
|
|
3615
3635
|
health: p.object({
|
|
3616
3636
|
status: p.enum(v).describe("The health status after triggering analysis."),
|
|
@@ -3618,11 +3638,11 @@ var Zo = { projectId: p.string().min(1).describe("The ID of the project to analy
|
|
|
3618
3638
|
updateInProgress: p.boolean().describe("Whether an analysis update is currently in progress.")
|
|
3619
3639
|
}).describe("The health response returned after triggering analysis."),
|
|
3620
3640
|
message: p.string().describe("A human-readable message about the analysis status.")
|
|
3621
|
-
},
|
|
3641
|
+
}, ts = {
|
|
3622
3642
|
name: B.ANALYZE_PROJECT_HEALTH,
|
|
3623
3643
|
description: "Trigger a new health analysis for a project. Use this when the health data is stale or you want a fresh assessment. The analysis may take time to complete — use get-project-health afterward to see updated results.",
|
|
3624
|
-
parameters:
|
|
3625
|
-
outputSchema:
|
|
3644
|
+
parameters: $o,
|
|
3645
|
+
outputSchema: es,
|
|
3626
3646
|
annotations: {
|
|
3627
3647
|
readOnlyHint: !1,
|
|
3628
3648
|
destructiveHint: !1,
|
|
@@ -3643,26 +3663,26 @@ var Zo = { projectId: p.string().min(1).describe("The ID of the project to analy
|
|
|
3643
3663
|
}
|
|
3644
3664
|
};
|
|
3645
3665
|
}
|
|
3646
|
-
},
|
|
3666
|
+
}, ns = { ids: p.array(p.string().min(1)).min(1).max(O.BULK_ACTIONS_PER_OPERATION).describe("The IDs of the tasks to complete.") }, rs = {
|
|
3647
3667
|
completed: p.array(p.string()).describe("The IDs of successfully completed tasks."),
|
|
3648
3668
|
failures: p.array(Y).describe("Failed task completions with error details."),
|
|
3649
3669
|
totalRequested: p.number().describe("The total number of tasks requested to complete."),
|
|
3650
3670
|
successCount: p.number().describe("The number of successfully completed tasks."),
|
|
3651
3671
|
failureCount: p.number().describe("The number of failed task completions.")
|
|
3652
|
-
},
|
|
3672
|
+
}, is = {
|
|
3653
3673
|
name: B.COMPLETE_TASKS,
|
|
3654
3674
|
description: "Complete one or more tasks by their IDs.",
|
|
3655
|
-
parameters:
|
|
3656
|
-
outputSchema:
|
|
3675
|
+
parameters: ns,
|
|
3676
|
+
outputSchema: rs,
|
|
3657
3677
|
annotations: {
|
|
3658
3678
|
readOnlyHint: !1,
|
|
3659
3679
|
destructiveHint: !0,
|
|
3660
3680
|
idempotentHint: !1
|
|
3661
3681
|
},
|
|
3662
3682
|
async execute(e, t) {
|
|
3663
|
-
let n = await
|
|
3683
|
+
let n = await as(t, e.ids), { succeeded: r, failures: i } = I(e.ids, n, (e) => e), a = r.map(({ item: e }) => e);
|
|
3664
3684
|
return L(B.COMPLETE_TASKS, e.ids.length, i), {
|
|
3665
|
-
textContent:
|
|
3685
|
+
textContent: ls({
|
|
3666
3686
|
completed: a,
|
|
3667
3687
|
failures: i,
|
|
3668
3688
|
args: e
|
|
@@ -3677,10 +3697,10 @@ var Zo = { projectId: p.string().min(1).describe("The ID of the project to analy
|
|
|
3677
3697
|
};
|
|
3678
3698
|
}
|
|
3679
3699
|
};
|
|
3680
|
-
async function
|
|
3700
|
+
async function as(e, t) {
|
|
3681
3701
|
let n = [...new Set(t)], r;
|
|
3682
3702
|
try {
|
|
3683
|
-
r = await
|
|
3703
|
+
r = await ss(e, n);
|
|
3684
3704
|
} catch (e) {
|
|
3685
3705
|
return t.map(() => ({
|
|
3686
3706
|
status: "rejected",
|
|
@@ -3706,19 +3726,19 @@ async function rs(e, t) {
|
|
|
3706
3726
|
let t = r.get(e);
|
|
3707
3727
|
return t?.status === "rejected" ? t : o.get(e) ?? {
|
|
3708
3728
|
status: "rejected",
|
|
3709
|
-
reason:
|
|
3729
|
+
reason: os(t?.value)
|
|
3710
3730
|
};
|
|
3711
3731
|
});
|
|
3712
3732
|
}
|
|
3713
|
-
function
|
|
3733
|
+
function os(e) {
|
|
3714
3734
|
return Error(e === "completed" ? "Task is already completed." : `Task not found, or already completed. Look for it with ${B.FIND_TASKS}, or ${B.FIND_COMPLETED_TASKS} if it may be done.`);
|
|
3715
3735
|
}
|
|
3716
|
-
async function
|
|
3736
|
+
async function ss(e, t) {
|
|
3717
3737
|
try {
|
|
3718
3738
|
let { results: n } = await R(() => e.getTasks({
|
|
3719
3739
|
ids: t,
|
|
3720
3740
|
limit: t.length
|
|
3721
|
-
})), r = new Map(n.map((e) => [e.id,
|
|
3741
|
+
})), r = new Map(n.map((e) => [e.id, cs(e)]));
|
|
3722
3742
|
return new Map(t.map((e) => [e, {
|
|
3723
3743
|
status: "fulfilled",
|
|
3724
3744
|
value: r.get(e) ?? "missing"
|
|
@@ -3735,17 +3755,17 @@ async function as(e, t) {
|
|
|
3735
3755
|
let r = n[t];
|
|
3736
3756
|
return [e, r?.status === "fulfilled" ? {
|
|
3737
3757
|
status: "fulfilled",
|
|
3738
|
-
value:
|
|
3758
|
+
value: cs(r.value)
|
|
3739
3759
|
} : {
|
|
3740
3760
|
status: "rejected",
|
|
3741
3761
|
reason: r?.reason
|
|
3742
3762
|
}];
|
|
3743
3763
|
}));
|
|
3744
3764
|
}
|
|
3745
|
-
function
|
|
3765
|
+
function cs(e) {
|
|
3746
3766
|
return e.checked ? "completed" : "open";
|
|
3747
3767
|
}
|
|
3748
|
-
function
|
|
3768
|
+
function ls({ completed: e, failures: t, args: n }) {
|
|
3749
3769
|
return Pi({
|
|
3750
3770
|
action: "Completed tasks",
|
|
3751
3771
|
success: e.length,
|
|
@@ -3755,13 +3775,13 @@ function ss({ completed: e, failures: t, args: n }) {
|
|
|
3755
3775
|
});
|
|
3756
3776
|
}
|
|
3757
3777
|
// src/utils/filter-resolver.ts
|
|
3758
|
-
var
|
|
3778
|
+
var us = 3e5, ds = new class {
|
|
3759
3779
|
constructor() {
|
|
3760
3780
|
this.cacheByClient = /* @__PURE__ */ new WeakMap();
|
|
3761
3781
|
}
|
|
3762
3782
|
async getFilters(e) {
|
|
3763
3783
|
let t = this.cacheByClient, n = t.get(e);
|
|
3764
|
-
if (n && Date.now() - n.timestamp <
|
|
3784
|
+
if (n && Date.now() - n.timestamp < us) return n.filters;
|
|
3765
3785
|
let r = ((await e.sync({
|
|
3766
3786
|
resourceTypes: ["filters"],
|
|
3767
3787
|
syncToken: "*"
|
|
@@ -3804,7 +3824,7 @@ var cs = 3e5, ls = new class {
|
|
|
3804
3824
|
clearCache() {
|
|
3805
3825
|
this.cacheByClient = /* @__PURE__ */ new WeakMap();
|
|
3806
3826
|
}
|
|
3807
|
-
}(),
|
|
3827
|
+
}(), fs = [
|
|
3808
3828
|
"project",
|
|
3809
3829
|
"section",
|
|
3810
3830
|
"task",
|
|
@@ -3814,38 +3834,38 @@ var cs = 3e5, ls = new class {
|
|
|
3814
3834
|
"folder",
|
|
3815
3835
|
"reminder",
|
|
3816
3836
|
"location_reminder"
|
|
3817
|
-
],
|
|
3818
|
-
type: p.enum(
|
|
3837
|
+
], ps = {
|
|
3838
|
+
type: p.enum(fs).describe("The type of entity to delete."),
|
|
3819
3839
|
id: p.string().min(1).describe("The ID of the entity to delete.")
|
|
3820
|
-
},
|
|
3840
|
+
}, ms = {
|
|
3821
3841
|
deletedEntity: p.object({
|
|
3822
|
-
type: p.enum(
|
|
3842
|
+
type: p.enum(fs).describe("The type of deleted entity."),
|
|
3823
3843
|
id: p.string().describe("The ID of the deleted entity.")
|
|
3824
3844
|
}).describe("Information about the deleted entity."),
|
|
3825
3845
|
success: p.boolean().describe("Whether the deletion was successful.")
|
|
3826
|
-
},
|
|
3827
|
-
function
|
|
3828
|
-
return e.length >
|
|
3846
|
+
}, hs = "This can't be undone.", gs = 80;
|
|
3847
|
+
function _s(e) {
|
|
3848
|
+
return e.length > gs ? `${e.slice(0, 79)}…` : e;
|
|
3829
3849
|
}
|
|
3830
|
-
async function
|
|
3850
|
+
async function vs(e, t, n) {
|
|
3831
3851
|
switch (t) {
|
|
3832
3852
|
case "section": return `the section "${(await e.getSection(n)).name}"`;
|
|
3833
|
-
case "task": return `the task "${
|
|
3834
|
-
case "comment": return `the comment "${
|
|
3853
|
+
case "task": return `the task "${_s((await e.getTask(n)).content)}"`;
|
|
3854
|
+
case "comment": return `the comment "${_s((await e.getComment(n)).content)}"`;
|
|
3835
3855
|
case "label": return `the label "${(await e.getLabel(n)).name}"`;
|
|
3836
3856
|
case "filter": {
|
|
3837
|
-
let t = await
|
|
3857
|
+
let t = await ds.findById(e, n);
|
|
3838
3858
|
return t ? `the filter "${t.name}"` : void 0;
|
|
3839
3859
|
}
|
|
3840
3860
|
case "folder": return `the folder "${(await e.getFolder(n)).name}"`;
|
|
3841
|
-
case "reminder": return `the reminder on the task "${
|
|
3842
|
-
case "location_reminder": return `the location reminder on the task "${
|
|
3861
|
+
case "reminder": return `the reminder on the task "${_s((await e.getTask((await e.getReminder(n)).itemId)).content)}"`;
|
|
3862
|
+
case "location_reminder": return `the location reminder on the task "${_s((await e.getTask((await e.getLocationReminder(n)).itemId)).content)}"`;
|
|
3843
3863
|
}
|
|
3844
3864
|
}
|
|
3845
|
-
async function
|
|
3846
|
-
return `Delete ${await r(t, () =>
|
|
3865
|
+
async function ys(e, t, n, { lookUp: r }) {
|
|
3866
|
+
return `Delete ${await r(t, () => vs(e, t, n)) ?? `the ${t.replace("_", " ")} (id=${n})`}? ${t === "folder" ? "Its projects are kept and moved to the top level of the workspace." : hs}`;
|
|
3847
3867
|
}
|
|
3848
|
-
async function
|
|
3868
|
+
async function bs(e, t, n) {
|
|
3849
3869
|
switch (t) {
|
|
3850
3870
|
case "project":
|
|
3851
3871
|
await e.deleteProject(n);
|
|
@@ -3876,11 +3896,11 @@ async function vs(e, t, n) {
|
|
|
3876
3896
|
return;
|
|
3877
3897
|
}
|
|
3878
3898
|
}
|
|
3879
|
-
var
|
|
3899
|
+
var xs = {
|
|
3880
3900
|
name: B.DELETE_OBJECT,
|
|
3881
3901
|
description: "Delete a project, section, task, comment, label, filter, folder, reminder, or location_reminder by its ID. Projects can be deleted whether active or archived (find archived ones via find-projects with archivedStatus); note a workspace project must be archived before it can be deleted, while personal projects can be deleted regardless. Deleting a folder keeps its projects, moving them to the top level of the workspace.",
|
|
3882
|
-
parameters:
|
|
3883
|
-
outputSchema:
|
|
3902
|
+
parameters: ps,
|
|
3903
|
+
outputSchema: ms,
|
|
3884
3904
|
annotations: {
|
|
3885
3905
|
readOnlyHint: !1,
|
|
3886
3906
|
destructiveHint: !0,
|
|
@@ -3891,10 +3911,10 @@ var ys = {
|
|
|
3891
3911
|
if (e.type === "project") {
|
|
3892
3912
|
let n = await G(t, e.id);
|
|
3893
3913
|
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
|
-
r = `Delete the project "${n.name}" and everything in it? ${
|
|
3914
|
+
r = `Delete the project "${n.name}" and everything in it? ${hs}`;
|
|
3895
3915
|
} else {
|
|
3896
3916
|
let n = e.type;
|
|
3897
|
-
r = (r) =>
|
|
3917
|
+
r = (r) => ys(t, n, e.id, r);
|
|
3898
3918
|
}
|
|
3899
3919
|
let i = await n?.confirm({
|
|
3900
3920
|
key: "delete",
|
|
@@ -3909,7 +3929,7 @@ var ys = {
|
|
|
3909
3929
|
},
|
|
3910
3930
|
success: !1
|
|
3911
3931
|
}
|
|
3912
|
-
} : (await
|
|
3932
|
+
} : (await bs(t, e.type, e.id), {
|
|
3913
3933
|
textContent: e.type === "folder" ? `Deleted folder: id=${e.id}. Its projects were kept and moved to the top level of the workspace.` : `Deleted ${e.type}: id=${e.id}`,
|
|
3914
3934
|
structuredContent: {
|
|
3915
3935
|
deletedEntity: {
|
|
@@ -3920,21 +3940,21 @@ var ys = {
|
|
|
3920
3940
|
}
|
|
3921
3941
|
});
|
|
3922
3942
|
}
|
|
3923
|
-
},
|
|
3943
|
+
}, Ss = 5, Cs = ["file", "url"], ws = {
|
|
3924
3944
|
projectId: p.string().min(1).describe("The ID of the project to export as CSV."),
|
|
3925
|
-
format: p.enum(
|
|
3945
|
+
format: p.enum(Cs).default("file").describe("How to return the CSV. \"file\" returns the CSV content, which can be passed straight back to import-into-project. \"url\" uploads it and returns a download link instead, so the CSV of a large project is not returned in full. The link is public, permanent and cannot be revoked: anyone holding it can open it, so only use it when the user asks for a link."),
|
|
3926
3946
|
useRelativeDates: p.boolean().optional().describe("Export due dates relative to the import date (e.g. \"day 3\") instead of absolute dates. Defaults to false.")
|
|
3927
|
-
},
|
|
3928
|
-
format: p.enum(
|
|
3947
|
+
}, Ts = {
|
|
3948
|
+
format: p.enum(Cs).describe("The format the template was exported in."),
|
|
3929
3949
|
content: p.string().optional().describe("The project as CSV. Only present when format is \"file\"."),
|
|
3930
3950
|
lineCount: p.number().optional().describe("Number of rows in the exported CSV. Only present when format is \"file\"."),
|
|
3931
3951
|
fileName: p.string().optional().describe("The generated file name. Only present when format is \"url\"."),
|
|
3932
3952
|
fileUrl: p.string().optional().describe("The shareable download URL. Only present when format is \"url\".")
|
|
3933
|
-
},
|
|
3953
|
+
}, Es = {
|
|
3934
3954
|
name: B.EXPORT_PROJECT,
|
|
3935
3955
|
description: "Export a project as CSV, like the app's \"Export as CSV\": as CSV content, or as a download link. To save a project as a template in the user's Todoist, use add-template instead. Use it to duplicate a project, share its structure, or hand the CSV to import-into-project. To read a project rather than export it, use find-tasks instead — it returns structured tasks rather than raw CSV. The project itself is not modified, but the \"url\" format uploads a copy and returns a public, permanent link that anyone holding it can open.",
|
|
3936
|
-
parameters:
|
|
3937
|
-
outputSchema:
|
|
3956
|
+
parameters: ws,
|
|
3957
|
+
outputSchema: Ts,
|
|
3938
3958
|
annotations: {
|
|
3939
3959
|
readOnlyHint: !1,
|
|
3940
3960
|
destructiveHint: !1,
|
|
@@ -3961,7 +3981,7 @@ var ys = {
|
|
|
3961
3981
|
useRelativeDates: n
|
|
3962
3982
|
}), a = i.split("\n").filter((e) => e.trim().length > 0);
|
|
3963
3983
|
return {
|
|
3964
|
-
textContent:
|
|
3984
|
+
textContent: Ds({
|
|
3965
3985
|
projectId: e,
|
|
3966
3986
|
lines: a
|
|
3967
3987
|
}),
|
|
@@ -3973,26 +3993,26 @@ var ys = {
|
|
|
3973
3993
|
};
|
|
3974
3994
|
}
|
|
3975
3995
|
};
|
|
3976
|
-
function
|
|
3977
|
-
let n = `Exported project (id=${e}) as CSV (${t.length} row${t.length === 1 ? "" : "s"}).`, r = t.slice(0,
|
|
3996
|
+
function Ds({ projectId: e, lines: t }) {
|
|
3997
|
+
let n = `Exported project (id=${e}) as CSV (${t.length} row${t.length === 1 ? "" : "s"}).`, r = t.slice(0, Ss).join("\n"), i = t.length - Ss;
|
|
3978
3998
|
return i > 0 ? `${n}\n\n${r}\n… ${i} more row${i === 1 ? "" : "s"} in the full content.` : `${n}\n\n${r}`;
|
|
3979
3999
|
}
|
|
3980
4000
|
// src/utils/children.ts
|
|
3981
|
-
var
|
|
4001
|
+
var Os = J.pick({
|
|
3982
4002
|
id: !0,
|
|
3983
4003
|
content: !0,
|
|
3984
4004
|
dueDate: !0,
|
|
3985
4005
|
checked: !0
|
|
3986
|
-
}).extend({ hasChildren: p.boolean().describe("Whether this subtask has subtasks of its own. Fetch it with includeChildren to expand.") }),
|
|
4006
|
+
}).extend({ hasChildren: p.boolean().describe("Whether this subtask has subtasks of its own. Fetch it with includeChildren to expand.") }), ks = mi.pick({
|
|
3987
4007
|
id: !0,
|
|
3988
4008
|
name: !0
|
|
3989
|
-
}).extend({ hasChildren: p.boolean().describe("Whether this sub-project has sub-projects of its own. Fetch it with includeChildren to expand.") }),
|
|
4009
|
+
}).extend({ hasChildren: p.boolean().describe("Whether this sub-project has sub-projects of its own. Fetch it with includeChildren to expand.") }), As = {
|
|
3990
4010
|
childCount: p.number().optional().describe("The number of direct children listed in children. Only present when children were requested and the type supports them. 0 means the object definitively has none."),
|
|
3991
|
-
children: p.array(p.union([
|
|
4011
|
+
children: p.array(p.union([Os, ks])).optional().describe("Direct children only: subtasks for a task, sub-projects for a project. Completed subtasks and archived sub-projects are excluded."),
|
|
3992
4012
|
hasMoreChildren: p.boolean().optional().describe(`Present when the object has more than ${D.CHILDREN_MAX} direct children and the list was truncated. Page through the rest with find-tasks by parentId for subtasks, or find-projects for sub-projects.`),
|
|
3993
4013
|
childrenError: p.string().optional().describe("Present when the children lookup failed or returned incomplete information. When no children are listed alongside it, childCount is unknown - do not read its absence as \"no children\".")
|
|
3994
4014
|
};
|
|
3995
|
-
async function
|
|
4015
|
+
async function js(e, t) {
|
|
3996
4016
|
let { results: n, nextCursor: r } = await e.getTasks({
|
|
3997
4017
|
parentId: t,
|
|
3998
4018
|
limit: D.CHILDREN_MAX
|
|
@@ -4016,7 +4036,7 @@ async function ks(e, t) {
|
|
|
4016
4036
|
childrenError: a ? `Could not check ${a} of ${n.length} subtasks for subtasks of their own; those are reported as hasChildren=false.` : void 0
|
|
4017
4037
|
};
|
|
4018
4038
|
}
|
|
4019
|
-
async function
|
|
4039
|
+
async function Ms(e, t) {
|
|
4020
4040
|
if (!ue(t)) return {
|
|
4021
4041
|
childCount: 0,
|
|
4022
4042
|
children: []
|
|
@@ -4038,30 +4058,30 @@ async function As(e, t) {
|
|
|
4038
4058
|
hasMoreChildren: i.length > a.length || void 0
|
|
4039
4059
|
};
|
|
4040
4060
|
}
|
|
4041
|
-
async function
|
|
4061
|
+
async function Ns(e) {
|
|
4042
4062
|
try {
|
|
4043
4063
|
return await e();
|
|
4044
4064
|
} catch (e) {
|
|
4045
4065
|
return { childrenError: e instanceof Error ? e.message : String(e) };
|
|
4046
4066
|
}
|
|
4047
4067
|
}
|
|
4048
|
-
function
|
|
4068
|
+
function Ps(e, t) {
|
|
4049
4069
|
if (t.childCount === void 0) return t.childrenError ? ` • ${e}=unavailable` : "";
|
|
4050
4070
|
let n = t.hasMoreChildren ? "+" : "", r = t.childrenError ? " (partial)" : "";
|
|
4051
4071
|
return ` • ${e}=${t.childCount}${n}${r}`;
|
|
4052
4072
|
}
|
|
4053
4073
|
// src/tools/fetch-object.ts
|
|
4054
|
-
var
|
|
4074
|
+
var Fs = [
|
|
4055
4075
|
"task",
|
|
4056
4076
|
"project",
|
|
4057
4077
|
"comment",
|
|
4058
4078
|
"section",
|
|
4059
4079
|
"template"
|
|
4060
|
-
],
|
|
4061
|
-
type: p.enum(
|
|
4080
|
+
], Is = {
|
|
4081
|
+
type: p.enum(Fs).describe("The type of object to fetch."),
|
|
4062
4082
|
id: p.string().regex(Ca).describe("The unique ID of the object to fetch. For a template, also a gallery slug (\"product-launch\") or a Todoist template URL."),
|
|
4063
4083
|
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
|
-
},
|
|
4084
|
+
}, Ls = p.object({
|
|
4065
4085
|
id: p.string(),
|
|
4066
4086
|
name: p.string(),
|
|
4067
4087
|
description: p.string(),
|
|
@@ -4070,22 +4090,22 @@ var Ns = [
|
|
|
4070
4090
|
sharedWithWorkspaceMembers: p.boolean().optional(),
|
|
4071
4091
|
canEdit: p.boolean().optional().describe("Whether update-template can change it."),
|
|
4072
4092
|
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.")
|
|
4073
|
-
}),
|
|
4074
|
-
type: p.enum(
|
|
4093
|
+
}), Rs = {
|
|
4094
|
+
type: p.enum(Fs).describe("The type of object fetched."),
|
|
4075
4095
|
id: p.string().describe("The ID of the fetched object."),
|
|
4076
4096
|
object: p.union([
|
|
4077
4097
|
J,
|
|
4078
4098
|
mi,
|
|
4079
4099
|
bi,
|
|
4080
4100
|
hi,
|
|
4081
|
-
|
|
4101
|
+
Ls
|
|
4082
4102
|
]).describe("The fetched object data."),
|
|
4083
|
-
...
|
|
4084
|
-
},
|
|
4103
|
+
...As
|
|
4104
|
+
}, zs = {
|
|
4085
4105
|
name: B.FETCH_OBJECT,
|
|
4086
4106
|
description: "Fetch a single task, project, comment, section, or template by its ID. Use this when you have a specific object ID and want to retrieve its full details. Set includeChildren to also get its direct subtasks or sub-projects. A template comes with its full content (layout, sections, tasks, comments): to edit a saved template's content, change it and send all of it back to update-template as `content`.",
|
|
4087
|
-
parameters:
|
|
4088
|
-
outputSchema:
|
|
4107
|
+
parameters: Is,
|
|
4108
|
+
outputSchema: Rs,
|
|
4089
4109
|
annotations: {
|
|
4090
4110
|
readOnlyHint: !0,
|
|
4091
4111
|
destructiveHint: !1,
|
|
@@ -4096,9 +4116,9 @@ var Ns = [
|
|
|
4096
4116
|
try {
|
|
4097
4117
|
switch (n) {
|
|
4098
4118
|
case "task": {
|
|
4099
|
-
let [e, a] = await Promise.all([t.getTask(r), i ?
|
|
4119
|
+
let [e, a] = await Promise.all([t.getTask(r), i ? Ns(() => js(t, r)) : Promise.resolve({})]), o = K(e);
|
|
4100
4120
|
return {
|
|
4101
|
-
textContent: `Found task: ${o.content} • id=${o.id} • priority=${o.priority} • project=${o.projectId}${
|
|
4121
|
+
textContent: `Found task: ${o.content} • id=${o.id} • priority=${o.priority} • project=${o.projectId}${Ps("subtasks", a)}`,
|
|
4102
4122
|
structuredContent: {
|
|
4103
4123
|
type: n,
|
|
4104
4124
|
id: r,
|
|
@@ -4108,9 +4128,9 @@ var Ns = [
|
|
|
4108
4128
|
};
|
|
4109
4129
|
}
|
|
4110
4130
|
case "project": {
|
|
4111
|
-
let e = await G(t, r), a = Jr(e), o = i ? await
|
|
4131
|
+
let e = await G(t, r), a = Jr(e), o = i ? await Ns(() => Ms(t, e)) : {};
|
|
4112
4132
|
return {
|
|
4113
|
-
textContent: `Found project: ${a.name} • id=${a.id} • color=${a.color}${a.icon ? ` • icon=${a.icon}` : ""} • viewStyle=${a.viewStyle}${
|
|
4133
|
+
textContent: `Found project: ${a.name} • id=${a.id} • color=${a.color}${a.icon ? ` • icon=${a.icon}` : ""} • viewStyle=${a.viewStyle}${Ps("subProjects", o)}`,
|
|
4114
4134
|
structuredContent: {
|
|
4115
4135
|
type: n,
|
|
4116
4136
|
id: r,
|
|
@@ -4144,11 +4164,11 @@ var Ns = [
|
|
|
4144
4164
|
};
|
|
4145
4165
|
}
|
|
4146
4166
|
case "template": {
|
|
4147
|
-
let e = Ta(r), [i, a] = await Promise.all([t.getTemplate(e),
|
|
4167
|
+
let e = Ta(r), [i, a] = await Promise.all([t.getTemplate(e), Bs(() => t.getTemplateContent(e))]), o = i.templateType === "setup";
|
|
4148
4168
|
if (!o && a.status === "rejected") throw a.reason;
|
|
4149
4169
|
let s = !o && a.status === "fulfilled" ? No(a.value.content) : void 0;
|
|
4150
4170
|
return {
|
|
4151
|
-
textContent: `Found template: ${i.name} • id=${i.id} • ${s ?
|
|
4171
|
+
textContent: `Found template: ${i.name} • id=${i.id} • ${s ? Uo(s) : "a setup template, which creates several projects and labels; its content cannot be read"}`,
|
|
4152
4172
|
structuredContent: {
|
|
4153
4173
|
type: n,
|
|
4154
4174
|
id: i.id,
|
|
@@ -4172,7 +4192,7 @@ var Ns = [
|
|
|
4172
4192
|
}
|
|
4173
4193
|
}
|
|
4174
4194
|
};
|
|
4175
|
-
async function
|
|
4195
|
+
async function Bs(e) {
|
|
4176
4196
|
try {
|
|
4177
4197
|
return {
|
|
4178
4198
|
status: "fulfilled",
|
|
@@ -4186,17 +4206,17 @@ async function Rs(e) {
|
|
|
4186
4206
|
}
|
|
4187
4207
|
}
|
|
4188
4208
|
// src/tools/fetch.ts
|
|
4189
|
-
var
|
|
4209
|
+
var Vs = { id: p.string().min(1).describe("A unique identifier for the document in the format \"task:{id}\" or \"project:{id}\".") }, Hs = {
|
|
4190
4210
|
id: p.string().describe("The ID of the fetched document."),
|
|
4191
4211
|
title: p.string().describe("The title of the document."),
|
|
4192
4212
|
text: p.string().describe("The text content of the document."),
|
|
4193
4213
|
url: p.string().describe("The URL of the document."),
|
|
4194
4214
|
metadata: p.record(p.string(), p.unknown()).optional().describe("Additional metadata about the document.")
|
|
4195
|
-
},
|
|
4215
|
+
}, Us = {
|
|
4196
4216
|
name: B.FETCH,
|
|
4197
4217
|
description: "Fetch the full contents of a task or project by its ID. The ID should be in the format \"task:{id}\" or \"project:{id}\". (Comments may exist; use find-comments to retrieve them.)",
|
|
4198
|
-
parameters:
|
|
4199
|
-
outputSchema:
|
|
4218
|
+
parameters: Vs,
|
|
4219
|
+
outputSchema: Hs,
|
|
4200
4220
|
annotations: {
|
|
4201
4221
|
readOnlyHint: !0,
|
|
4202
4222
|
destructiveHint: !1,
|
|
@@ -4250,32 +4270,32 @@ var zs = { id: p.string().min(1).describe("A unique identifier for the document
|
|
|
4250
4270
|
structuredContent: a
|
|
4251
4271
|
};
|
|
4252
4272
|
}
|
|
4253
|
-
},
|
|
4254
|
-
function
|
|
4255
|
-
return Q(e).pipe(
|
|
4273
|
+
}, Ws = p.union([p.iso.date(), p.iso.datetime({ offset: !0 })]);
|
|
4274
|
+
function Gs(e) {
|
|
4275
|
+
return Q(e).pipe(Ws.optional());
|
|
4256
4276
|
}
|
|
4257
|
-
var
|
|
4277
|
+
var Ks = {
|
|
4258
4278
|
objectType: p.enum(g).optional().describe("Type of object to filter by."),
|
|
4259
4279
|
objectId: p.string().optional().describe("Filter by specific object ID (task, project, or comment). Requires objectType."),
|
|
4260
4280
|
eventType: p.enum(h).optional().describe("Type of event to filter by."),
|
|
4261
4281
|
projectId: p.string().optional().describe("Filter events by parent project ID."),
|
|
4262
4282
|
taskId: p.string().optional().describe("Filter events by parent task ID (for subtask events)."),
|
|
4263
4283
|
initiatorId: p.string().optional().describe("Filter by the user ID who initiated the event. A first-person question (\"what did I complete\") needs this: without it the results cover every collaborator. Get the ID from user-info when you do not already have it."),
|
|
4264
|
-
dateFrom:
|
|
4265
|
-
dateTo:
|
|
4284
|
+
dateFrom: Gs("Inclusive start of the activity range, as an ISO 8601 date or date-time. For all events on one local calendar day, use that day's start, for example \"2026-08-02T00:00:00-04:00\". Natural-language dates such as \"tomorrow\" are not supported."),
|
|
4285
|
+
dateTo: Gs("Exclusive end of the activity range, as an ISO 8601 date or date-time. For all events on 2026-08-02, use \"2026-08-03T00:00:00-04:00\". Natural-language dates such as \"tomorrow\" are not supported."),
|
|
4266
4286
|
limit: p.number().int().min(1).max(D.ACTIVITY_MAX).default(D.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
|
|
4267
4287
|
cursor: p.string().optional().describe("Pagination cursor for retrieving the next page of results.")
|
|
4268
|
-
},
|
|
4288
|
+
}, qs = {
|
|
4269
4289
|
events: p.array(xi).describe("The activity events."),
|
|
4270
4290
|
nextCursor: p.string().optional(),
|
|
4271
4291
|
totalCount: p.number().describe("The total number of events in this page."),
|
|
4272
4292
|
hasMore: p.boolean(),
|
|
4273
4293
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
4274
|
-
},
|
|
4294
|
+
}, Js = {
|
|
4275
4295
|
name: B.FIND_ACTIVITY,
|
|
4276
4296
|
description: "Retrieve activity logs to monitor and audit changes in Todoist. Shows events from all users by default (use initiatorId to filter by specific user). To answer what someone completed in a period, including recurring task occurrences, use objectType \"task\", eventType \"completed\", and dateFrom/dateTo. For a first-person question (\"what did I get done\"), also set initiatorId to the current user from user-info, or the answer includes collaborators' completions. Track task completions, updates, deletions, project changes, and more with flexible filtering. Activity history availability and retention depend on the user plan.",
|
|
4277
|
-
parameters:
|
|
4278
|
-
outputSchema:
|
|
4297
|
+
parameters: Ks,
|
|
4298
|
+
outputSchema: qs,
|
|
4279
4299
|
annotations: {
|
|
4280
4300
|
readOnlyHint: !0,
|
|
4281
4301
|
destructiveHint: !1,
|
|
@@ -4289,9 +4309,9 @@ var Ws = {
|
|
|
4289
4309
|
cursor: d ?? null
|
|
4290
4310
|
};
|
|
4291
4311
|
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(Xr), _ = h.length > 0 ? await
|
|
4312
|
+
let { results: p, nextCursor: m } = await t.getActivityLogs(f), h = p.map(Xr), _ = h.length > 0 ? await Zs(t) : void 0, v = Qs(_);
|
|
4293
4313
|
return {
|
|
4294
|
-
textContent:
|
|
4314
|
+
textContent: $s({
|
|
4295
4315
|
events: h,
|
|
4296
4316
|
args: e,
|
|
4297
4317
|
nextCursor: m,
|
|
@@ -4307,26 +4327,26 @@ var Ws = {
|
|
|
4307
4327
|
}
|
|
4308
4328
|
};
|
|
4309
4329
|
}
|
|
4310
|
-
},
|
|
4311
|
-
function
|
|
4330
|
+
}, Ys = "UTC";
|
|
4331
|
+
function Xs(e) {
|
|
4312
4332
|
try {
|
|
4313
4333
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
4314
4334
|
} catch {
|
|
4315
4335
|
return !1;
|
|
4316
4336
|
}
|
|
4317
4337
|
}
|
|
4318
|
-
async function
|
|
4338
|
+
async function Zs(e) {
|
|
4319
4339
|
try {
|
|
4320
4340
|
return await R(() => e.getUser());
|
|
4321
4341
|
} catch (e) {
|
|
4322
4342
|
return console.error(`${B.FIND_ACTIVITY}: could not load the user's time zone, using UTC`, e), null;
|
|
4323
4343
|
}
|
|
4324
4344
|
}
|
|
4325
|
-
function
|
|
4345
|
+
function Qs(e) {
|
|
4326
4346
|
let t = e?.tzInfo?.timezone;
|
|
4327
|
-
return t &&
|
|
4347
|
+
return t && Xs(t) ? t : Ys;
|
|
4328
4348
|
}
|
|
4329
|
-
function
|
|
4349
|
+
function $s({ events: e, args: t, nextCursor: n, initiatorNames: r, timeZone: i }) {
|
|
4330
4350
|
let a = "Activity events", o = [];
|
|
4331
4351
|
if (t.eventType && o.push(`${t.eventType}`), t.objectType) {
|
|
4332
4352
|
let e = t.objectType === "task" ? "tasks" : `${t.objectType}s`;
|
|
@@ -4343,20 +4363,20 @@ function Zs({ events: e, args: t, nextCursor: n, initiatorNames: r, timeZone: i
|
|
|
4343
4363
|
nextCursor: n ?? void 0,
|
|
4344
4364
|
filterHints: s,
|
|
4345
4365
|
notes: e.length > 0 ? [`Times are in ${i}.`] : void 0,
|
|
4346
|
-
previewLines:
|
|
4366
|
+
previewLines: ec(e, r, i, Math.min(e.length, t.limit)),
|
|
4347
4367
|
zeroReasonHints: c
|
|
4348
4368
|
});
|
|
4349
4369
|
}
|
|
4350
|
-
function
|
|
4351
|
-
let i = e.slice(0, r).map((e) =>
|
|
4370
|
+
function ec(e, t, n, r = 10) {
|
|
4371
|
+
let i = e.slice(0, r).map((e) => tc(e, t, n)).join("\n");
|
|
4352
4372
|
if (e.length > r) {
|
|
4353
4373
|
let t = e.length - r;
|
|
4354
4374
|
return `${i}\n ... and ${t} more event${t === 1 ? "" : "s"}`;
|
|
4355
4375
|
}
|
|
4356
4376
|
return i;
|
|
4357
4377
|
}
|
|
4358
|
-
function
|
|
4359
|
-
let r =
|
|
4378
|
+
function tc(e, t, n) {
|
|
4379
|
+
let r = nc(e.eventDate, n), i = `${e.eventType} ${e.objectType}`, a = "";
|
|
4360
4380
|
if (e.extraData) {
|
|
4361
4381
|
let t = e.extraData.content || e.extraData.name || e.extraData.last_content;
|
|
4362
4382
|
t && typeof t == "string" && (a = ` • "${t.length > 50 ? `${t.substring(0, 47)}...` : t}"`);
|
|
@@ -4369,7 +4389,7 @@ function $s(e, t, n) {
|
|
|
4369
4389
|
let c = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
|
|
4370
4390
|
return ` [${r}] ${i}${a}${o}${s}${c}`;
|
|
4371
4391
|
}
|
|
4372
|
-
function
|
|
4392
|
+
function nc(e, t) {
|
|
4373
4393
|
try {
|
|
4374
4394
|
let n = new Date(e);
|
|
4375
4395
|
return `${n.toLocaleDateString("en-US", {
|
|
@@ -4389,24 +4409,24 @@ function ec(e, t) {
|
|
|
4389
4409
|
}
|
|
4390
4410
|
}
|
|
4391
4411
|
// src/tools/find-comments.ts
|
|
4392
|
-
var
|
|
4412
|
+
var rc = {
|
|
4393
4413
|
taskId: p.string().optional().describe("Find comments for a specific task."),
|
|
4394
4414
|
projectId: p.string().optional().describe("Find comments for a specific project. Project ID should be an ID string, or the text \"inbox\", for inbox tasks."),
|
|
4395
4415
|
commentId: p.string().optional().describe("Get a specific comment by ID."),
|
|
4396
4416
|
cursor: p.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
4397
4417
|
limit: p.number().int().min(1).max(D.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
4398
|
-
},
|
|
4418
|
+
}, ic = {
|
|
4399
4419
|
comments: p.array(bi).describe("The found comments."),
|
|
4400
4420
|
searchType: p.string().describe("The type of search performed: \"single\" (comment ID), \"task\" (task ID), or \"project\" (project ID)."),
|
|
4401
4421
|
searchId: p.string().describe("The ID that was searched for (comment, task, or project ID)."),
|
|
4402
4422
|
hasMore: p.boolean(),
|
|
4403
4423
|
nextCursor: p.string().optional(),
|
|
4404
4424
|
totalCount: p.number().describe("The total number of comments in this page.")
|
|
4405
|
-
},
|
|
4425
|
+
}, ac = {
|
|
4406
4426
|
name: B.FIND_COMMENTS,
|
|
4407
4427
|
description: "Find comments by task, project, or get a specific comment by ID. Exactly one of taskId, projectId, or commentId must be provided.",
|
|
4408
|
-
parameters:
|
|
4409
|
-
outputSchema:
|
|
4428
|
+
parameters: rc,
|
|
4429
|
+
outputSchema: ic,
|
|
4410
4430
|
annotations: {
|
|
4411
4431
|
readOnlyHint: !0,
|
|
4412
4432
|
destructiveHint: !1,
|
|
@@ -4442,7 +4462,7 @@ var tc = {
|
|
|
4442
4462
|
} else throw Error("Invalid state: no search parameter provided");
|
|
4443
4463
|
let c = s.map(Yr);
|
|
4444
4464
|
return {
|
|
4445
|
-
textContent:
|
|
4465
|
+
textContent: oc({
|
|
4446
4466
|
comments: c,
|
|
4447
4467
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
4448
4468
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
@@ -4460,7 +4480,7 @@ var tc = {
|
|
|
4460
4480
|
};
|
|
4461
4481
|
}
|
|
4462
4482
|
};
|
|
4463
|
-
function
|
|
4483
|
+
function oc({ comments: e, searchType: t, searchId: n, hasMore: r, nextCursor: i }) {
|
|
4464
4484
|
if (e.length === 0) return `No comments found for ${t}${t === "single" ? "" : ` ${n}`}`;
|
|
4465
4485
|
let a;
|
|
4466
4486
|
if (t === "single") {
|
|
@@ -4477,43 +4497,43 @@ function ic({ comments: e, searchType: t, searchId: n, hasMore: r, nextCursor: i
|
|
|
4477
4497
|
}
|
|
4478
4498
|
return a;
|
|
4479
4499
|
}
|
|
4480
|
-
var
|
|
4500
|
+
var sc = {
|
|
4481
4501
|
labels: p.string().array().max(D.FILTER_VALUES_MAX).optional().describe("The labels to filter the tasks by"),
|
|
4482
4502
|
labelsOperator: p.enum(["and", "or"]).optional().describe("The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is \"or\".")
|
|
4483
4503
|
};
|
|
4484
|
-
function
|
|
4504
|
+
function cc(e) {
|
|
4485
4505
|
let t = e.trim();
|
|
4486
4506
|
return t.startsWith("@") ? t.slice(1) : t;
|
|
4487
4507
|
}
|
|
4488
|
-
function
|
|
4508
|
+
function lc(e = [], t = "or") {
|
|
4489
4509
|
if (e.length === 0) return "";
|
|
4490
4510
|
let n = t === "and" ? " & " : " | ";
|
|
4491
|
-
return `(${e.map((e) => `@${ae(
|
|
4511
|
+
return `(${e.map((e) => `@${ae(cc(e))}`).join(` ${n} `)})`;
|
|
4492
4512
|
}
|
|
4493
|
-
function
|
|
4513
|
+
function uc(e) {
|
|
4494
4514
|
return e.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase();
|
|
4495
4515
|
}
|
|
4496
|
-
function
|
|
4497
|
-
let r = new Set(e.map(
|
|
4516
|
+
function dc(e, t, n = "or") {
|
|
4517
|
+
let r = new Set(e.map(uc)), i = t.map((e) => uc(cc(e)));
|
|
4498
4518
|
return n === "and" ? i.every((e) => r.has(e)) : i.some((e) => r.has(e));
|
|
4499
4519
|
}
|
|
4500
|
-
function
|
|
4501
|
-
let n = cc(
|
|
4520
|
+
function fc(e, t) {
|
|
4521
|
+
let n = uc(cc(e)), r = new Set(t.filter((e) => uc(e) === n));
|
|
4502
4522
|
return r.size === 1 ? [...r][0] : void 0;
|
|
4503
4523
|
}
|
|
4504
|
-
function
|
|
4505
|
-
return e.map((e) => `@${
|
|
4524
|
+
function pc(e, t = "or") {
|
|
4525
|
+
return e.map((e) => `@${cc(e)}`).join(t === "and" ? " & " : " | ");
|
|
4506
4526
|
}
|
|
4507
4527
|
// src/tools/find-completed-tasks.ts
|
|
4508
|
-
var { FIND_ACTIVITY:
|
|
4509
|
-
function
|
|
4528
|
+
var { FIND_ACTIVITY: mc } = B;
|
|
4529
|
+
function hc({ since: e, until: t, userGmtOffset: n, now: r = /* @__PURE__ */ new Date() }) {
|
|
4510
4530
|
let i = jn(r, An(n)), a = t ?? (e ? Mn(e, 6) : i);
|
|
4511
4531
|
return {
|
|
4512
4532
|
since: e ?? Mn(a, -6),
|
|
4513
4533
|
until: a
|
|
4514
4534
|
};
|
|
4515
4535
|
}
|
|
4516
|
-
var
|
|
4536
|
+
var gc = {
|
|
4517
4537
|
getBy: p.enum(["completion", "due"]).default("completion").describe("The method to use to get the tasks: \"completion\" to get tasks by completion date (ie, when the task was actually completed), \"due\" to get tasks by due date (ie, when the task was due to be completed by)."),
|
|
4518
4538
|
since: p.iso.date().optional().describe("Optional start date for completed tasks. Format: YYYY-MM-DD. Defaults to 6 days before until (or today if until is omitted), resulting in a 7-day window."),
|
|
4519
4539
|
until: p.iso.date().optional().describe("Optional end date for completed tasks. Format: YYYY-MM-DD. Defaults to 6 days after since (or today if since is omitted), resulting in a 7-day window."),
|
|
@@ -4524,18 +4544,18 @@ var mc = {
|
|
|
4524
4544
|
responsibleUser: p.string().optional().describe("Filter completed tasks assigned to this user. User ID, name, or email. For personal queries (summaries, plans, reports), set to current user from user-info to exclude collaborators. Defaults to all collaborators."),
|
|
4525
4545
|
limit: p.number().int().min(1).max(D.COMPLETED_TASKS_MAX).default(D.COMPLETED_TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
4526
4546
|
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
|
-
...
|
|
4528
|
-
},
|
|
4547
|
+
...sc
|
|
4548
|
+
}, _c = {
|
|
4529
4549
|
tasks: p.array(J).describe("The found completed tasks."),
|
|
4530
4550
|
nextCursor: p.string().optional(),
|
|
4531
4551
|
totalCount: p.number().describe("The total number of tasks in this page."),
|
|
4532
4552
|
hasMore: p.boolean(),
|
|
4533
4553
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
4534
|
-
},
|
|
4554
|
+
}, vc = {
|
|
4535
4555
|
name: B.FIND_COMPLETED_TASKS,
|
|
4536
4556
|
description: "Get completed tasks in a date range. Neither getBy mode returns completions of a recurring task that is still active. For \"what did I complete/get done\" questions, or whenever recurring work should count, use find-activity instead — it reports completion events, including every occurrence of a recurring task. since/until are optional and default to a 7-day window when omitted. Includes all collaborators by default. Person-specific queries (summaries, plans, reports) require responsibleUser.",
|
|
4537
|
-
parameters:
|
|
4538
|
-
outputSchema:
|
|
4557
|
+
parameters: gc,
|
|
4558
|
+
outputSchema: _c,
|
|
4539
4559
|
annotations: {
|
|
4540
4560
|
readOnlyHint: !0,
|
|
4541
4561
|
destructiveHint: !1,
|
|
@@ -4544,12 +4564,12 @@ var mc = {
|
|
|
4544
4564
|
async execute(e, t) {
|
|
4545
4565
|
let { getBy: n, labels: r, labelsOperator: i, since: a, until: o, responsibleUser: s, projectId: c, cursor: l, ...u } = e, d = Qr(l);
|
|
4546
4566
|
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
|
-
let f = await Ar(t, s), p = f?.email, m =
|
|
4567
|
+
let f = await Ar(t, s), p = f?.email, m = lc(r, i);
|
|
4548
4568
|
f && p && (m = jr(m, `assigned to: ${p}`));
|
|
4549
4569
|
let h = await t.getUser(), g = h.tzInfo?.gmtString || "+00:00", _ = await Pr({
|
|
4550
4570
|
projectId: c,
|
|
4551
4571
|
user: h
|
|
4552
|
-
}), v =
|
|
4572
|
+
}), v = hc({
|
|
4553
4573
|
since: a,
|
|
4554
4574
|
until: o,
|
|
4555
4575
|
userGmtOffset: g
|
|
@@ -4583,7 +4603,7 @@ var mc = {
|
|
|
4583
4603
|
} : {}
|
|
4584
4604
|
}), w = C.map(K);
|
|
4585
4605
|
return {
|
|
4586
|
-
textContent:
|
|
4606
|
+
textContent: yc({
|
|
4587
4607
|
tasks: w,
|
|
4588
4608
|
args: ee,
|
|
4589
4609
|
userGmtOffset: g,
|
|
@@ -4602,10 +4622,10 @@ var mc = {
|
|
|
4602
4622
|
};
|
|
4603
4623
|
}
|
|
4604
4624
|
};
|
|
4605
|
-
function
|
|
4625
|
+
function yc({ tasks: e, args: t, userGmtOffset: n, userTimezone: r, nextCursor: i, assigneeEmail: a, assigneeNames: o }) {
|
|
4606
4626
|
let s = t.getBy === "completion" ? "completed" : "due", c = `Completed tasks (by ${s} date)`, l = [];
|
|
4607
4627
|
if (l.push(`${s} date: ${t.since} to ${t.until}`), t.projectId && l.push(`project: ${t.projectId}`), t.sectionId && l.push(`section: ${t.sectionId}`), t.parentId && l.push(`parent: ${t.parentId}`), t.workspaceId && l.push(`workspace: ${t.workspaceId}`), t.labels && t.labels.length > 0) {
|
|
4608
|
-
let e =
|
|
4628
|
+
let e = pc(t.labels, t.labelsOperator);
|
|
4609
4629
|
l.push(`labels: ${e}`);
|
|
4610
4630
|
}
|
|
4611
4631
|
if (t.responsibleUser) {
|
|
@@ -4619,30 +4639,30 @@ function _c({ tasks: e, args: t, userGmtOffset: n, userTimezone: r, nextCursor:
|
|
|
4619
4639
|
limit: t.limit,
|
|
4620
4640
|
nextCursor: i ?? void 0,
|
|
4621
4641
|
filterHints: l,
|
|
4622
|
-
notes: [
|
|
4642
|
+
notes: [bc(t, n, r)],
|
|
4623
4643
|
previewLines: Ri(e, Math.min(e.length, t.limit), o),
|
|
4624
4644
|
zeroReasonHints: u
|
|
4625
4645
|
});
|
|
4626
4646
|
}
|
|
4627
|
-
function
|
|
4647
|
+
function bc(e, t, n) {
|
|
4628
4648
|
let r = "Completions of recurring tasks that are still active are not in this list.";
|
|
4629
|
-
if (e.getBy === "due") return `${r} ${
|
|
4649
|
+
if (e.getBy === "due") return `${r} ${mc} with objectType "task" and eventType "completed" reports them, but only by completion time: it cannot match a due-date range.`;
|
|
4630
4650
|
let i = (e) => Rn({
|
|
4631
4651
|
date: e,
|
|
4632
4652
|
timeZone: n,
|
|
4633
4653
|
fallbackOffset: t
|
|
4634
4654
|
});
|
|
4635
|
-
return `${r} To include them, call ${
|
|
4655
|
+
return `${r} To include them, call ${mc} with objectType "task", eventType "completed", dateFrom "${i(e.since)}" and dateTo "${i(Mn(e.until, 1))}".`;
|
|
4636
4656
|
}
|
|
4637
4657
|
// src/tools/find-folders.ts
|
|
4638
|
-
var { ADD_FOLDERS:
|
|
4658
|
+
var { ADD_FOLDERS: xc, FIND_PROJECTS: Sc, LIST_WORKSPACES: Cc } = B, wc = { workspace: p.string().trim().min(1).optional().describe(`The workspace to list folders for, by name or ID (see ${Cc}). Omit to list the folders of every workspace.`) }, Tc = {
|
|
4639
4659
|
folders: p.array(_i).describe("In sidebar order within each workspace."),
|
|
4640
4660
|
totalCount: p.number()
|
|
4641
|
-
},
|
|
4661
|
+
}, Ec = {
|
|
4642
4662
|
name: B.FIND_FOLDERS,
|
|
4643
|
-
description: `List the folders that group a workspace's projects. Only workspace projects go in folders; personal projects nest under a parent project instead. To see a folder's projects, use ${
|
|
4644
|
-
parameters:
|
|
4645
|
-
outputSchema:
|
|
4663
|
+
description: `List the folders that group a workspace's projects. Only workspace projects go in folders; personal projects nest under a parent project instead. To see a folder's projects, use ${Sc} with folderId.`,
|
|
4664
|
+
parameters: wc,
|
|
4665
|
+
outputSchema: Tc,
|
|
4646
4666
|
annotations: {
|
|
4647
4667
|
readOnlyHint: !0,
|
|
4648
4668
|
destructiveHint: !1,
|
|
@@ -4651,10 +4671,10 @@ var { ADD_FOLDERS: yc, FIND_PROJECTS: bc, LIST_WORKSPACES: xc } = B, Sc = { work
|
|
|
4651
4671
|
async execute({ workspace: e }, t) {
|
|
4652
4672
|
let n = e ? [await oa.resolveWorkspace(t, e)] : await oa.listWorkspaces(t), r = await Promise.all(n.map(async (e) => ({
|
|
4653
4673
|
...e,
|
|
4654
|
-
folders: await
|
|
4674
|
+
folders: await Dc(t, e.workspaceId)
|
|
4655
4675
|
}))), i = r.flatMap((e) => e.folders);
|
|
4656
4676
|
return {
|
|
4657
|
-
textContent:
|
|
4677
|
+
textContent: Oc(r),
|
|
4658
4678
|
structuredContent: {
|
|
4659
4679
|
folders: i,
|
|
4660
4680
|
totalCount: i.length
|
|
@@ -4662,38 +4682,38 @@ var { ADD_FOLDERS: yc, FIND_PROJECTS: bc, LIST_WORKSPACES: xc } = B, Sc = { work
|
|
|
4662
4682
|
};
|
|
4663
4683
|
}
|
|
4664
4684
|
};
|
|
4665
|
-
async function
|
|
4685
|
+
async function Dc(e, t) {
|
|
4666
4686
|
return (await W({
|
|
4667
4687
|
apiMethod: (t) => R(() => e.getFolders(t)),
|
|
4668
4688
|
args: { workspaceId: t },
|
|
4669
4689
|
limit: D.FOLDERS_MAX
|
|
4670
4690
|
})).sort((e, t) => e.defaultOrder - t.defaultOrder).map(vi);
|
|
4671
4691
|
}
|
|
4672
|
-
function
|
|
4692
|
+
function Oc(e) {
|
|
4673
4693
|
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 }) => Z({
|
|
4674
4694
|
subject: `Folders in ${t} (id=${e})`,
|
|
4675
4695
|
count: n.length,
|
|
4676
4696
|
previewLines: n.map((e) => ` ${e.name} • id=${e.id}`).join("\n"),
|
|
4677
|
-
zeroReasonHints: ["No folders in this workspace", `Use ${
|
|
4697
|
+
zeroReasonHints: ["No folders in this workspace", `Use ${xc} to create one`]
|
|
4678
4698
|
})).join("\n");
|
|
4679
4699
|
}
|
|
4680
4700
|
// src/tools/find-labels.ts
|
|
4681
|
-
var
|
|
4701
|
+
var kc = {
|
|
4682
4702
|
searchText: p.string().optional().describe("Search for a label by name (partial and case insensitive match). Supports wildcards (e.g. \"work*\" for prefix match). Use \"\\*\" for a literal asterisk. If omitted, all labels are returned."),
|
|
4683
4703
|
limit: p.number().int().min(1).max(D.LABELS_MAX).default(D.LABELS_DEFAULT).describe("The maximum number of labels to return."),
|
|
4684
4704
|
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
|
-
},
|
|
4705
|
+
}, Ac = {
|
|
4686
4706
|
labels: p.array(Ci).describe("The found personal labels."),
|
|
4687
4707
|
nextCursor: p.string().optional(),
|
|
4688
4708
|
totalCount: p.number().describe("The total number of labels in this page."),
|
|
4689
4709
|
hasMore: p.boolean(),
|
|
4690
4710
|
sharedLabels: p.array(p.string()).describe("Names of all shared labels visible to you. These have no IDs or metadata — use their names directly when filtering tasks."),
|
|
4691
4711
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
4692
|
-
},
|
|
4712
|
+
}, jc = {
|
|
4693
4713
|
name: B.FIND_LABELS,
|
|
4694
4714
|
description: "List personal labels and shared labels. Personal labels have full metadata (id, name, color, order, isFavorite) and support pagination and name search (partial, case insensitive). Shared labels are labels used on tasks shared with you — they are returned as names only (no IDs or metadata). When searching, all matching personal labels are fetched across all pages and returned as a single result set (limit and cursor are ignored). When not searching, personal labels are returned with pagination.",
|
|
4695
|
-
parameters:
|
|
4696
|
-
outputSchema:
|
|
4715
|
+
parameters: kc,
|
|
4716
|
+
outputSchema: Ac,
|
|
4697
4717
|
annotations: {
|
|
4698
4718
|
readOnlyHint: !0,
|
|
4699
4719
|
destructiveHint: !1,
|
|
@@ -4711,7 +4731,7 @@ var Dc = {
|
|
|
4711
4731
|
cursor: e.cursor
|
|
4712
4732
|
};
|
|
4713
4733
|
return {
|
|
4714
|
-
textContent:
|
|
4734
|
+
textContent: Mc({
|
|
4715
4735
|
labels: i,
|
|
4716
4736
|
args: e,
|
|
4717
4737
|
nextCursor: a,
|
|
@@ -4728,7 +4748,7 @@ var Dc = {
|
|
|
4728
4748
|
};
|
|
4729
4749
|
}
|
|
4730
4750
|
};
|
|
4731
|
-
function
|
|
4751
|
+
function Mc({ labels: e, args: t, nextCursor: n, sharedLabels: r }) {
|
|
4732
4752
|
let i = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", a = [];
|
|
4733
4753
|
t.searchText && a.push(`searchText: "${t.searchText}"`);
|
|
4734
4754
|
let o = e.slice(0, 10).map(Ii).join("\n"), s = e.length - 10, c = s > 0 ? `${o}\n …and ${s} more` : o, l = [];
|
|
@@ -4745,10 +4765,10 @@ function Ac({ labels: e, args: t, nextCursor: n, sharedLabels: r }) {
|
|
|
4745
4765
|
}) + u;
|
|
4746
4766
|
}
|
|
4747
4767
|
// src/tools/find-project-collaborators.ts
|
|
4748
|
-
var { FIND_PROJECTS:
|
|
4768
|
+
var { FIND_PROJECTS: Nc, ADD_TASKS: Pc, UPDATE_TASKS: Fc } = B, Ic = {
|
|
4749
4769
|
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
4770
|
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
|
-
},
|
|
4771
|
+
}, Lc = {
|
|
4752
4772
|
collaborators: p.array(Si).describe("The found users."),
|
|
4753
4773
|
projectInfo: p.object({
|
|
4754
4774
|
id: p.string().describe("The project ID."),
|
|
@@ -4758,11 +4778,11 @@ var { FIND_PROJECTS: jc, ADD_TASKS: Mc, UPDATE_TASKS: Nc } = B, Pc = {
|
|
|
4758
4778
|
totalCount: p.number().describe("The total number of users found."),
|
|
4759
4779
|
totalAvailable: p.number().optional().describe("The total number of available users before the search filter was applied."),
|
|
4760
4780
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
4761
|
-
},
|
|
4781
|
+
}, Rc = {
|
|
4762
4782
|
name: B.FIND_PROJECT_COLLABORATORS,
|
|
4763
4783
|
description: "Find Todoist users (collaborators, teammates) by name or email to look up their user ID. Use this whenever the user asks to find, look up, or identify a person — e.g. \"find Carrie's user ID\", \"who is Ernesto\", \"look up a user\". When projectId is omitted, searches across the collaborators of every shared project the authenticated user has access to, plus the authenticated user themselves — an empty result means the person is not a collaborator on any project you share with them, not necessarily that they do not exist in Todoist. When projectId is provided, searches only that project. Partial, case-insensitive match on name and email.",
|
|
4764
|
-
parameters:
|
|
4765
|
-
outputSchema:
|
|
4784
|
+
parameters: Ic,
|
|
4785
|
+
outputSchema: Lc,
|
|
4766
4786
|
annotations: {
|
|
4767
4787
|
readOnlyHint: !0,
|
|
4768
4788
|
destructiveHint: !1,
|
|
@@ -4770,7 +4790,7 @@ var { FIND_PROJECTS: jc, ADD_TASKS: Mc, UPDATE_TASKS: Nc } = B, Pc = {
|
|
|
4770
4790
|
},
|
|
4771
4791
|
async execute(e, t) {
|
|
4772
4792
|
let { projectId: n, searchTerm: r } = e;
|
|
4773
|
-
if (!n) return
|
|
4793
|
+
if (!n) return zc({
|
|
4774
4794
|
searchTerm: r,
|
|
4775
4795
|
client: t,
|
|
4776
4796
|
appliedFilters: e
|
|
@@ -4779,7 +4799,7 @@ var { FIND_PROJECTS: jc, ADD_TASKS: Mc, UPDATE_TASKS: Nc } = B, Pc = {
|
|
|
4779
4799
|
try {
|
|
4780
4800
|
if (a = await G(t, n), !a) throw Error(`Project with ID "${n}" not found or not accessible`);
|
|
4781
4801
|
if (i = a.name, !a.isShared) return {
|
|
4782
|
-
textContent: `Project "${i}" is not shared and has no collaborators.\n\n**Next steps:**\n• Share the project to enable collaboration\n• Use ${
|
|
4802
|
+
textContent: `Project "${i}" is not shared and has no collaborators.\n\n**Next steps:**\n• Share the project to enable collaboration\n• Use ${Pc} and ${Fc} for assignment features once shared`,
|
|
4783
4803
|
structuredContent: {
|
|
4784
4804
|
collaborators: [],
|
|
4785
4805
|
projectInfo: {
|
|
@@ -4808,9 +4828,9 @@ var { FIND_PROJECTS: jc, ADD_TASKS: Mc, UPDATE_TASKS: Nc } = B, Pc = {
|
|
|
4808
4828
|
appliedFilters: e
|
|
4809
4829
|
}
|
|
4810
4830
|
};
|
|
4811
|
-
let s =
|
|
4831
|
+
let s = Vc(o, r);
|
|
4812
4832
|
return {
|
|
4813
|
-
textContent:
|
|
4833
|
+
textContent: Hc({
|
|
4814
4834
|
collaborators: s,
|
|
4815
4835
|
projectName: i,
|
|
4816
4836
|
searchTerm: r,
|
|
@@ -4830,10 +4850,10 @@ var { FIND_PROJECTS: jc, ADD_TASKS: Mc, UPDATE_TASKS: Nc } = B, Pc = {
|
|
|
4830
4850
|
};
|
|
4831
4851
|
}
|
|
4832
4852
|
};
|
|
4833
|
-
async function
|
|
4834
|
-
let r = await
|
|
4853
|
+
async function zc({ searchTerm: e, client: t, appliedFilters: n }) {
|
|
4854
|
+
let r = await Bc(t, await H.getAllCollaborators(t));
|
|
4835
4855
|
if (r.length === 0) return {
|
|
4836
|
-
textContent: `No users found. You may have no shared projects, or collaborator data is not accessible.\n\n**Next steps:**\n• Use ${
|
|
4856
|
+
textContent: `No users found. You may have no shared projects, or collaborator data is not accessible.\n\n**Next steps:**\n• Use ${Nc} to find shared projects\n• Share a project to add collaborators\n• Ensure you have permission to view collaborators`,
|
|
4837
4857
|
structuredContent: {
|
|
4838
4858
|
collaborators: [],
|
|
4839
4859
|
projectInfo: void 0,
|
|
@@ -4842,9 +4862,9 @@ async function Lc({ searchTerm: e, client: t, appliedFilters: n }) {
|
|
|
4842
4862
|
appliedFilters: n
|
|
4843
4863
|
}
|
|
4844
4864
|
};
|
|
4845
|
-
let i =
|
|
4865
|
+
let i = Vc(r, e);
|
|
4846
4866
|
return {
|
|
4847
|
-
textContent:
|
|
4867
|
+
textContent: Hc({
|
|
4848
4868
|
collaborators: i,
|
|
4849
4869
|
projectName: void 0,
|
|
4850
4870
|
searchTerm: e,
|
|
@@ -4859,7 +4879,7 @@ async function Lc({ searchTerm: e, client: t, appliedFilters: n }) {
|
|
|
4859
4879
|
}
|
|
4860
4880
|
};
|
|
4861
4881
|
}
|
|
4862
|
-
async function
|
|
4882
|
+
async function Bc(e, t) {
|
|
4863
4883
|
try {
|
|
4864
4884
|
let n = await e.getUser();
|
|
4865
4885
|
return !n || t.some((e) => e.id === n.id) ? t : [{
|
|
@@ -4871,12 +4891,12 @@ async function Rc(e, t) {
|
|
|
4871
4891
|
return t;
|
|
4872
4892
|
}
|
|
4873
4893
|
}
|
|
4874
|
-
function
|
|
4894
|
+
function Vc(e, t) {
|
|
4875
4895
|
if (!t) return e;
|
|
4876
4896
|
let n = t.toLowerCase().trim();
|
|
4877
4897
|
return e.filter((e) => e.name.toLowerCase().includes(n) || e.email.toLowerCase().includes(n));
|
|
4878
4898
|
}
|
|
4879
|
-
function
|
|
4899
|
+
function Hc({ collaborators: e, projectName: t, searchTerm: n, totalAvailable: r }) {
|
|
4880
4900
|
let i = t ? `project "${t}"` : "workspace", a = t ? "Project collaborators" : "Workspace users", o = n ? `${a} matching "${n}"` : a, s = [];
|
|
4881
4901
|
n && s.push(`matching "${n}"`), s.push(`in ${i}`);
|
|
4882
4902
|
let c = [];
|
|
@@ -4884,7 +4904,7 @@ function Bc({ collaborators: e, projectName: t, searchTerm: n, totalAvailable: r
|
|
|
4884
4904
|
let l = [];
|
|
4885
4905
|
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
4906
|
let u = [];
|
|
4887
|
-
return e.length > 0 ? (u.push(`Use ${
|
|
4907
|
+
return e.length > 0 ? (u.push(`Use ${Pc} with responsibleUser to assign new tasks`), u.push(`Use ${Fc} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${Nc} to find other projects`), n && r > 0 && u.push("Try searching without filters to see all users")), Z({
|
|
4888
4908
|
subject: o,
|
|
4889
4909
|
count: e.length,
|
|
4890
4910
|
filterHints: s,
|
|
@@ -4894,11 +4914,11 @@ function Bc({ collaborators: e, projectName: t, searchTerm: n, totalAvailable: r
|
|
|
4894
4914
|
});
|
|
4895
4915
|
}
|
|
4896
4916
|
// src/tools/find-projects.ts
|
|
4897
|
-
var { ADD_PROJECTS:
|
|
4917
|
+
var { ADD_PROJECTS: Uc, FIND_FOLDERS: Wc, PROJECT_MANAGEMENT: Gc } = B, Kc = {
|
|
4898
4918
|
active: "projects",
|
|
4899
4919
|
archived: "archived projects",
|
|
4900
4920
|
all: "projects (active and archived)"
|
|
4901
|
-
},
|
|
4921
|
+
}, qc = {
|
|
4902
4922
|
searchText: p.string().optional().describe("Search for a project by name (partial and case insensitive match). Supports wildcards (e.g. \"work*\" for prefix match). Use \"\\*\" for a literal asterisk. If omitted, all projects are returned."),
|
|
4903
4923
|
limit: p.number().int().min(1).max(D.PROJECTS_MAX).default(D.PROJECTS_DEFAULT).describe("The maximum number of projects to return."),
|
|
4904
4924
|
cursor: p.string().optional().describe("The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."),
|
|
@@ -4907,26 +4927,26 @@ var { ADD_PROJECTS: Vc, FIND_FOLDERS: Hc, PROJECT_MANAGEMENT: Uc } = B, Wc = {
|
|
|
4907
4927
|
"archived",
|
|
4908
4928
|
"all"
|
|
4909
4929
|
]).optional().describe("Which projects to return by archive status: 'active' (default, non-archived only), 'archived' (archived only), or 'all' (both active and archived). Each project includes an isArchived field. Archived projects can be deleted via the delete-object tool (type: 'project')."),
|
|
4910
|
-
folderId: p.string().min(1).optional().describe(`Only projects in this workspace folder (see ${
|
|
4911
|
-
includeUnjoined: p.boolean().optional().describe(`Also list workspace projects the user can join but hasn't, in unjoinedProjects (first page only). They can't be read until joined; join with ${
|
|
4912
|
-
},
|
|
4930
|
+
folderId: p.string().min(1).optional().describe(`Only projects in this workspace folder (see ${Wc}).`),
|
|
4931
|
+
includeUnjoined: p.boolean().optional().describe(`Also list workspace projects the user can join but hasn't, in unjoinedProjects (first page only). They can't be read until joined; join with ${Gc} (action 'join') only when the user asks.`)
|
|
4932
|
+
}, Jc = p.object({
|
|
4913
4933
|
id: p.string(),
|
|
4914
4934
|
name: p.string(),
|
|
4915
4935
|
workspaceId: p.string(),
|
|
4916
4936
|
url: p.string()
|
|
4917
|
-
}),
|
|
4937
|
+
}), Yc = {
|
|
4918
4938
|
projects: p.array(mi).describe("The found projects."),
|
|
4919
4939
|
nextCursor: p.string().optional(),
|
|
4920
4940
|
totalCount: p.number().describe("The total number of projects in this page."),
|
|
4921
4941
|
hasMore: p.boolean(),
|
|
4922
4942
|
appliedFilters: p.record(p.string(), p.unknown()),
|
|
4923
|
-
unjoinedProjects: p.array(
|
|
4943
|
+
unjoinedProjects: p.array(Jc).optional().describe("Up to limit. With includeUnjoined, or when a search matched no joined project."),
|
|
4924
4944
|
unjoinedHasMore: p.boolean().optional().describe("More matched than limit; narrow with searchText.")
|
|
4925
|
-
},
|
|
4945
|
+
}, Xc = {
|
|
4926
4946
|
name: B.FIND_PROJECTS,
|
|
4927
4947
|
description: "List or search by name the projects the user has joined. By default only active projects are returned; use archivedStatus ('archived' or 'all') to include archived projects. When searching, when archivedStatus is 'all', or when listing archived projects in a folder, all matching projects are returned (pagination is ignored). Otherwise projects are returned with pagination. Workspace projects the user hasn't joined are left out unless includeUnjoined is set, or a search matches no joined project.",
|
|
4928
|
-
parameters:
|
|
4929
|
-
outputSchema:
|
|
4948
|
+
parameters: qc,
|
|
4949
|
+
outputSchema: Yc,
|
|
4930
4950
|
annotations: {
|
|
4931
4951
|
readOnlyHint: !0,
|
|
4932
4952
|
destructiveHint: !1,
|
|
@@ -4934,7 +4954,7 @@ var { ADD_PROJECTS: Vc, FIND_FOLDERS: Hc, PROJECT_MANAGEMENT: Uc } = B, Wc = {
|
|
|
4934
4954
|
},
|
|
4935
4955
|
async execute(e, t) {
|
|
4936
4956
|
let { searchText: n } = e, r = e.archivedStatus ?? "active", i, a = null;
|
|
4937
|
-
if (
|
|
4957
|
+
if (Zc(e)) {
|
|
4938
4958
|
let a = Promise.resolve([]), [o, s] = await Promise.all([r === "archived" ? a : n ? Ir(t, n) : Lr(t, e.folderId), r === "active" ? a : Vr(t)]), c = n ? Ur(n) : null, l = c ? s.filter((e) => c.test(e.name)) : s, { folderId: u } = e, d = [...o, ...l];
|
|
4939
4959
|
i = u ? d.filter((e) => E(e) && e.folderId === u) : d;
|
|
4940
4960
|
} else {
|
|
@@ -4948,9 +4968,9 @@ var { ADD_PROJECTS: Vc, FIND_FOLDERS: Hc, PROJECT_MANAGEMENT: Uc } = B, Wc = {
|
|
|
4948
4968
|
});
|
|
4949
4969
|
i = n.results, a = n.nextCursor;
|
|
4950
4970
|
}
|
|
4951
|
-
let o = i.map(Jr), s = await
|
|
4971
|
+
let o = i.map(Jr), s = await $c(t, e, o.length);
|
|
4952
4972
|
return {
|
|
4953
|
-
textContent:
|
|
4973
|
+
textContent: tl({
|
|
4954
4974
|
projects: o,
|
|
4955
4975
|
args: e,
|
|
4956
4976
|
nextCursor: a,
|
|
@@ -4962,21 +4982,21 @@ var { ADD_PROJECTS: Vc, FIND_FOLDERS: Hc, PROJECT_MANAGEMENT: Uc } = B, Wc = {
|
|
|
4962
4982
|
totalCount: o.length,
|
|
4963
4983
|
hasMore: !!a,
|
|
4964
4984
|
appliedFilters: e,
|
|
4965
|
-
unjoinedProjects: s?.listed.map(
|
|
4985
|
+
unjoinedProjects: s?.listed.map(el),
|
|
4966
4986
|
unjoinedHasMore: s ? s.total > s.listed.length : void 0
|
|
4967
4987
|
}
|
|
4968
4988
|
};
|
|
4969
4989
|
}
|
|
4970
4990
|
};
|
|
4971
|
-
function
|
|
4991
|
+
function Zc({ searchText: e, archivedStatus: t, folderId: n }) {
|
|
4972
4992
|
return !!e || t === "all" || !!n && t === "archived";
|
|
4973
4993
|
}
|
|
4974
|
-
function
|
|
4975
|
-
return e.archivedStatus === "archived" ? !1 :
|
|
4994
|
+
function Qc(e) {
|
|
4995
|
+
return e.archivedStatus === "archived" ? !1 : Zc(e) || !e.cursor;
|
|
4976
4996
|
}
|
|
4977
|
-
async function
|
|
4997
|
+
async function $c(e, t, n) {
|
|
4978
4998
|
let { includeUnjoined: r, searchText: i, limit: a } = t, o = !!i && n === 0;
|
|
4979
|
-
if (!
|
|
4999
|
+
if (!Qc(t) || !(r || o)) return;
|
|
4980
5000
|
let s;
|
|
4981
5001
|
try {
|
|
4982
5002
|
s = await Rr(e);
|
|
@@ -4990,7 +5010,7 @@ async function Zc(e, t, n) {
|
|
|
4990
5010
|
total: u.length
|
|
4991
5011
|
};
|
|
4992
5012
|
}
|
|
4993
|
-
function
|
|
5013
|
+
function el({ id: e, name: t, workspaceId: n, url: r }) {
|
|
4994
5014
|
return {
|
|
4995
5015
|
id: e,
|
|
4996
5016
|
name: t,
|
|
@@ -4998,15 +5018,15 @@ function Qc({ id: e, name: t, workspaceId: n, url: r }) {
|
|
|
4998
5018
|
url: r
|
|
4999
5019
|
};
|
|
5000
5020
|
}
|
|
5001
|
-
function
|
|
5002
|
-
let i =
|
|
5021
|
+
function tl({ projects: e, args: t, nextCursor: n, unjoined: r }) {
|
|
5022
|
+
let i = Kc[t.archivedStatus ?? "active"], a = t.searchText ? `All ${i} matching "${t.searchText}"` : `${i.charAt(0).toUpperCase()}${i.slice(1)}`, o = [];
|
|
5003
5023
|
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
5024
|
let s = e.slice(0, 10).map(Li).join("\n"), c = e.length - 10, l = c > 0 ? `${s}\n …and ${c} more` : s, u = [], d = t.folderId ? " in this folder" : "";
|
|
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") :
|
|
5025
|
+
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") : Qc(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 ${Uc} to create a project`)) : (u.push(`No active projects${d}`), u.push("Use archivedStatus: 'all' to include archived projects"), t.folderId || u.push(`Use ${Uc} to create a project`)), t.folderId && !r?.total && u.push(`Use ${Wc} to check the folder ID`));
|
|
5006
5026
|
let f = Z({
|
|
5007
5027
|
subject: a,
|
|
5008
5028
|
count: e.length,
|
|
5009
|
-
limit:
|
|
5029
|
+
limit: Zc(t) ? void 0 : t.limit,
|
|
5010
5030
|
nextCursor: n ?? void 0,
|
|
5011
5031
|
filterHints: o,
|
|
5012
5032
|
previewLines: l,
|
|
@@ -5018,24 +5038,24 @@ function $c({ projects: e, args: t, nextCursor: n, unjoined: r }) {
|
|
|
5018
5038
|
f,
|
|
5019
5039
|
`Workspace projects the user hasn't joined (${r.total}):`,
|
|
5020
5040
|
...p,
|
|
5021
|
-
`Their tasks, comments and activity can't be read until the user joins. Ask the user before joining one with ${
|
|
5041
|
+
`Their tasks, comments and activity can't be read until the user joins. Ask the user before joining one with ${Gc} (action: "join").`
|
|
5022
5042
|
].join("\n");
|
|
5023
5043
|
}
|
|
5024
5044
|
// src/tools/find-reminders.ts
|
|
5025
|
-
var
|
|
5045
|
+
var nl = {
|
|
5026
5046
|
taskId: p.string().optional().describe("Find all reminders for a specific task. Returns both time-based and location reminders."),
|
|
5027
5047
|
reminderId: p.string().optional().describe("Get a specific time-based reminder (relative or absolute) by its ID."),
|
|
5028
5048
|
locationReminderId: p.string().optional().describe("Get a specific location reminder by its ID.")
|
|
5029
|
-
},
|
|
5049
|
+
}, rl = {
|
|
5030
5050
|
reminders: p.array(Ti).describe("The found reminders (time-based and location)."),
|
|
5031
5051
|
searchType: p.string().describe("The search type used: \"task\", \"reminder\", or \"location_reminder\"."),
|
|
5032
5052
|
searchId: p.string().describe("The ID used for the search."),
|
|
5033
5053
|
totalCount: p.number().describe("Total reminders in this response.")
|
|
5034
|
-
},
|
|
5054
|
+
}, il = {
|
|
5035
5055
|
name: B.FIND_REMINDERS,
|
|
5036
5056
|
description: "Find reminders by task ID (returns all reminder types), or get a specific reminder by its ID. Use reminderId for time-based reminders and locationReminderId for location reminders.",
|
|
5037
|
-
parameters:
|
|
5038
|
-
outputSchema:
|
|
5057
|
+
parameters: nl,
|
|
5058
|
+
outputSchema: rl,
|
|
5039
5059
|
annotations: {
|
|
5040
5060
|
readOnlyHint: !0,
|
|
5041
5061
|
destructiveHint: !1,
|
|
@@ -5082,7 +5102,7 @@ var el = {
|
|
|
5082
5102
|
args: { taskId: n }
|
|
5083
5103
|
})]), i = [...e, ...r].map(ti);
|
|
5084
5104
|
return {
|
|
5085
|
-
textContent:
|
|
5105
|
+
textContent: al(i, n),
|
|
5086
5106
|
structuredContent: {
|
|
5087
5107
|
reminders: i,
|
|
5088
5108
|
searchType: "task",
|
|
@@ -5094,7 +5114,7 @@ var el = {
|
|
|
5094
5114
|
throw Error("One of taskId, reminderId, or locationReminderId must be provided.");
|
|
5095
5115
|
}
|
|
5096
5116
|
};
|
|
5097
|
-
function
|
|
5117
|
+
function al(e, t) {
|
|
5098
5118
|
if (e.length === 0) return `No reminders found for task ${t}`;
|
|
5099
5119
|
let { timeBasedCount: n, locationCount: r } = ni(e), i = [];
|
|
5100
5120
|
if (n > 0) {
|
|
@@ -5108,11 +5128,11 @@ function rl(e, t) {
|
|
|
5108
5128
|
return `Found ${i.join(" and ")} for task ${t}`;
|
|
5109
5129
|
}
|
|
5110
5130
|
// src/tools/find-sections.ts
|
|
5111
|
-
var { ADD_SECTIONS:
|
|
5131
|
+
var { ADD_SECTIONS: ol } = B, sl = {
|
|
5112
5132
|
active: "Sections",
|
|
5113
5133
|
archived: "Archived sections",
|
|
5114
5134
|
all: "Sections (active and archived)"
|
|
5115
|
-
},
|
|
5135
|
+
}, cl = {
|
|
5116
5136
|
projectId: p.string().min(1).describe("The ID of the project to search sections in. Project ID should be an ID string, or the text \"inbox\", for inbox tasks."),
|
|
5117
5137
|
searchText: p.string().optional().describe("Search for a section by name (partial and case insensitive match). Supports wildcards (e.g. \"work*\" for prefix match). Use \"\\*\" for a literal asterisk. If omitted, all sections in the project are returned."),
|
|
5118
5138
|
archivedStatus: p.enum([
|
|
@@ -5120,15 +5140,15 @@ var { ADD_SECTIONS: il } = B, al = {
|
|
|
5120
5140
|
"archived",
|
|
5121
5141
|
"all"
|
|
5122
5142
|
]).optional().describe("Default 'active'. 'archived' returns only archived sections, 'all' both.")
|
|
5123
|
-
},
|
|
5124
|
-
sections: p.array(
|
|
5143
|
+
}, ll = hi.extend({ isArchived: p.boolean() }), ul = {
|
|
5144
|
+
sections: p.array(ll).describe("The found sections."),
|
|
5125
5145
|
totalCount: p.number().describe("The total number of sections found."),
|
|
5126
5146
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
5127
|
-
},
|
|
5147
|
+
}, dl = {
|
|
5128
5148
|
name: B.FIND_SECTIONS,
|
|
5129
5149
|
description: "Search for sections by name or other criteria in a project. When searching, uses server-side search to avoid fetching all sections. Archived sections are left out unless archivedStatus is set.",
|
|
5130
|
-
parameters:
|
|
5131
|
-
outputSchema:
|
|
5150
|
+
parameters: cl,
|
|
5151
|
+
outputSchema: ul,
|
|
5132
5152
|
annotations: {
|
|
5133
5153
|
readOnlyHint: !0,
|
|
5134
5154
|
destructiveHint: !1,
|
|
@@ -5138,9 +5158,9 @@ var { ADD_SECTIONS: il } = B, al = {
|
|
|
5138
5158
|
let n = await Pr({
|
|
5139
5159
|
projectId: e.projectId,
|
|
5140
5160
|
client: t
|
|
5141
|
-
}) ?? e.projectId, r = e.archivedStatus ?? "active", i = Promise.resolve([]), [a, o] = await Promise.all([r === "archived" ? i :
|
|
5161
|
+
}) ?? e.projectId, r = e.archivedStatus ?? "active", i = Promise.resolve([]), [a, o] = await Promise.all([r === "archived" ? i : fl(t, n, e.searchText), r === "active" ? i : Hr(t, n)]), s = e.searchText ? Ur(e.searchText) : null, c = s ? o.filter((e) => s.test(e.name)) : o, l = [...a, ...c].map(pl);
|
|
5142
5162
|
return {
|
|
5143
|
-
textContent:
|
|
5163
|
+
textContent: ml({
|
|
5144
5164
|
sections: l,
|
|
5145
5165
|
projectId: e.projectId,
|
|
5146
5166
|
searchText: e.searchText,
|
|
@@ -5154,19 +5174,19 @@ var { ADD_SECTIONS: il } = B, al = {
|
|
|
5154
5174
|
};
|
|
5155
5175
|
}
|
|
5156
5176
|
};
|
|
5157
|
-
async function
|
|
5177
|
+
async function fl(e, t, n) {
|
|
5158
5178
|
return n ? qr(e, n, t) : (await e.getSections({ projectId: t })).results;
|
|
5159
5179
|
}
|
|
5160
|
-
function
|
|
5180
|
+
function pl(e) {
|
|
5161
5181
|
return {
|
|
5162
5182
|
...gi(e),
|
|
5163
5183
|
isArchived: e.isArchived
|
|
5164
5184
|
};
|
|
5165
5185
|
}
|
|
5166
|
-
function
|
|
5186
|
+
function ml({ sections: e, projectId: t, searchText: n, archivedStatus: r }) {
|
|
5167
5187
|
let i = [];
|
|
5168
|
-
n ? (i.push("Try broader search terms"), i.push("Check spelling"), i.push("Remove searchText to see all sections")) : r === "archived" ? (i.push("No archived sections in this project"), i.push("Use archivedStatus: 'all' to also see active sections")) : (i.push("Project has no sections yet"), i.push(`Use ${
|
|
5169
|
-
let a = `${
|
|
5188
|
+
n ? (i.push("Try broader search terms"), i.push("Check spelling"), i.push("Remove searchText to see all sections")) : r === "archived" ? (i.push("No archived sections in this project"), i.push("Use archivedStatus: 'all' to also see active sections")) : (i.push("Project has no sections yet"), i.push(`Use ${ol} to create sections`)), r === "active" && i.push("Use archivedStatus: 'all' to include archived sections");
|
|
5189
|
+
let a = `${sl[r]} in project ${t}`, o = n ? `${a} matching "${n}"` : a, s = e.length > 0 ? e.map((e) => {
|
|
5170
5190
|
let t = e.isArchived ? " • Archived" : "";
|
|
5171
5191
|
return ` ${e.name}${t} • id=${e.id}`;
|
|
5172
5192
|
}).join("\n") : void 0;
|
|
@@ -5178,19 +5198,19 @@ function fl({ sections: e, projectId: t, searchText: n, archivedStatus: r }) {
|
|
|
5178
5198
|
});
|
|
5179
5199
|
}
|
|
5180
5200
|
// src/tools/find-tasks-by-date.ts
|
|
5181
|
-
function
|
|
5201
|
+
function hl(e) {
|
|
5182
5202
|
return /* @__PURE__ */ new Date(`${e}T00:00:00`);
|
|
5183
5203
|
}
|
|
5184
|
-
var
|
|
5185
|
-
async function
|
|
5186
|
-
if (t) return t.tzInfo?.gmtString ||
|
|
5204
|
+
var gl = "+00:00";
|
|
5205
|
+
async function _l(e, t) {
|
|
5206
|
+
if (t) return t.tzInfo?.gmtString || gl;
|
|
5187
5207
|
try {
|
|
5188
|
-
return (await R(() => e.getUser())).tzInfo?.gmtString ||
|
|
5208
|
+
return (await R(() => e.getUser())).tzInfo?.gmtString || gl;
|
|
5189
5209
|
} catch (e) {
|
|
5190
|
-
return console.error(`${B.FIND_TASKS_BY_DATE}: could not load the user's timezone, using UTC`, e),
|
|
5210
|
+
return console.error(`${B.FIND_TASKS_BY_DATE}: could not load the user's timezone, using UTC`, e), gl;
|
|
5191
5211
|
}
|
|
5192
5212
|
}
|
|
5193
|
-
var
|
|
5213
|
+
var vl = {
|
|
5194
5214
|
startDate: p.string().regex(/^(\d{4}-\d{2}-\d{2}|today)$/).optional().describe("The start date to get the tasks for. Format: YYYY-MM-DD, or 'today', which by default also includes overdue tasks. Defaults to 'today' when omitted, except with overdueOption='overdue-only'."),
|
|
5195
5215
|
overdueOption: p.enum([
|
|
5196
5216
|
"overdue-only",
|
|
@@ -5202,18 +5222,18 @@ var gl = {
|
|
|
5202
5222
|
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)."),
|
|
5203
5223
|
responsibleUser: p.string().optional().describe("Filter tasks assigned to this user. User ID, name, or email. The current user also includes unassigned tasks."),
|
|
5204
5224
|
responsibleUserFiltering: p.enum(kr).optional().describe("Filter when responsibleUser is omitted. 'assigned'=assigned to others; 'unassignedOrMe'=unassigned+mine; 'all'=everyone. Default: 'unassignedOrMe'."),
|
|
5205
|
-
...
|
|
5206
|
-
},
|
|
5225
|
+
...sc
|
|
5226
|
+
}, yl = {
|
|
5207
5227
|
tasks: p.array(J).describe("The found tasks."),
|
|
5208
5228
|
nextCursor: p.string().optional(),
|
|
5209
5229
|
totalCount: p.number().describe("The total number of tasks in this page."),
|
|
5210
5230
|
hasMore: p.boolean(),
|
|
5211
5231
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
5212
|
-
},
|
|
5232
|
+
}, bl = {
|
|
5213
5233
|
name: B.FIND_TASKS_BY_DATE,
|
|
5214
5234
|
description: "Get tasks by date range. startDate='today' includes overdue items. Default responsibleUserFiltering='unassignedOrMe' excludes others' tasks.",
|
|
5215
|
-
parameters:
|
|
5216
|
-
outputSchema:
|
|
5235
|
+
parameters: vl,
|
|
5236
|
+
outputSchema: yl,
|
|
5217
5237
|
annotations: {
|
|
5218
5238
|
readOnlyHint: !0,
|
|
5219
5239
|
destructiveHint: !1,
|
|
@@ -5227,14 +5247,14 @@ var gl = {
|
|
|
5227
5247
|
if (n.overdueOption === "overdue-only") u = "overdue";
|
|
5228
5248
|
else if (n.startDate === "today") {
|
|
5229
5249
|
if (n.daysCount > 1) {
|
|
5230
|
-
let e = await
|
|
5250
|
+
let e = await _l(t, c), r = jn(/* @__PURE__ */ new Date(), An(e)), i = `(due after: ${r} | due: ${r}) & due before: ${Mn(r, n.daysCount)}`;
|
|
5231
5251
|
u = n.overdueOption === "exclude-overdue" ? i : `(${i} | overdue)`;
|
|
5232
5252
|
} else u = n.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
5233
5253
|
} else if (n.startDate) {
|
|
5234
|
-
let e = n.startDate, t = me(
|
|
5254
|
+
let e = n.startDate, t = me(hl(e), n.daysCount);
|
|
5235
5255
|
u = `(due after: ${e} | due: ${e}) & due before: ${he(t, { representation: "date" })}`;
|
|
5236
5256
|
}
|
|
5237
|
-
let d =
|
|
5257
|
+
let d = lc(n.labels, n.labelsOperator);
|
|
5238
5258
|
d.length > 0 && (u = jr(u, `(${d})`));
|
|
5239
5259
|
let f = Mr({
|
|
5240
5260
|
resolvedAssigneeId: a,
|
|
@@ -5250,7 +5270,7 @@ var gl = {
|
|
|
5250
5270
|
limit: n.limit
|
|
5251
5271
|
});
|
|
5252
5272
|
return {
|
|
5253
|
-
textContent:
|
|
5273
|
+
textContent: xl({
|
|
5254
5274
|
tasks: p,
|
|
5255
5275
|
args: n,
|
|
5256
5276
|
nextCursor: m,
|
|
@@ -5267,7 +5287,7 @@ var gl = {
|
|
|
5267
5287
|
};
|
|
5268
5288
|
}
|
|
5269
5289
|
};
|
|
5270
|
-
function
|
|
5290
|
+
function xl({ tasks: e, args: t, nextCursor: n, assigneeEmail: r, assigneeNames: i }) {
|
|
5271
5291
|
let a = [];
|
|
5272
5292
|
if (t.overdueOption === "overdue-only") a.push("overdue tasks only");
|
|
5273
5293
|
else if (t.startDate === "today") {
|
|
@@ -5275,7 +5295,7 @@ function yl({ tasks: e, args: t, nextCursor: n, assigneeEmail: r, assigneeNames:
|
|
|
5275
5295
|
a.push(`today${e}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`);
|
|
5276
5296
|
} else t.startDate && a.push(Nn(t.startDate, t.daysCount));
|
|
5277
5297
|
if (t.labels && t.labels.length > 0) {
|
|
5278
|
-
let e =
|
|
5298
|
+
let e = pc(t.labels, t.labelsOperator);
|
|
5279
5299
|
a.push(`labels: ${e}`);
|
|
5280
5300
|
}
|
|
5281
5301
|
if (t.responsibleUser) {
|
|
@@ -5311,27 +5331,27 @@ function yl({ tasks: e, args: t, nextCursor: n, assigneeEmail: r, assigneeNames:
|
|
|
5311
5331
|
});
|
|
5312
5332
|
}
|
|
5313
5333
|
// src/utils/filtered-pages.ts
|
|
5314
|
-
var
|
|
5334
|
+
var Sl = 5, Cl = "resume:", wl = "Invalid cursor. Pass the nextCursor from the previous call unchanged, with the same parameters.", Tl = p.object({
|
|
5315
5335
|
next: p.string(),
|
|
5316
5336
|
state: p.unknown().optional()
|
|
5317
5337
|
});
|
|
5318
|
-
function
|
|
5319
|
-
return `${
|
|
5338
|
+
function El(e) {
|
|
5339
|
+
return `${Cl}${Buffer.from(JSON.stringify(e)).toString("base64url")}`;
|
|
5320
5340
|
}
|
|
5321
|
-
function
|
|
5341
|
+
function Dl(e) {
|
|
5322
5342
|
if (e) {
|
|
5323
|
-
if (!e.startsWith(
|
|
5343
|
+
if (!e.startsWith(Cl)) throw Error(wl);
|
|
5324
5344
|
try {
|
|
5325
5345
|
let t = e.slice(7);
|
|
5326
|
-
return
|
|
5346
|
+
return Tl.parse(JSON.parse(Buffer.from(t, "base64url").toString()));
|
|
5327
5347
|
} catch {
|
|
5328
|
-
throw Error(
|
|
5348
|
+
throw Error(wl);
|
|
5329
5349
|
}
|
|
5330
5350
|
}
|
|
5331
5351
|
}
|
|
5332
|
-
async function
|
|
5352
|
+
async function Ol({ fetchPage: e, matches: t, limit: n, maxPageSize: r, from: i, state: a }) {
|
|
5333
5353
|
let o = [], s = i?.next, c = null;
|
|
5334
|
-
for (let i = 0; i <
|
|
5354
|
+
for (let i = 0; i < Sl; i++) {
|
|
5335
5355
|
let { results: i, nextCursor: l } = await e({
|
|
5336
5356
|
cursor: c,
|
|
5337
5357
|
limit: r
|
|
@@ -5344,7 +5364,7 @@ async function El({ fetchPage: e, matches: t, limit: n, maxPageSize: r, from: i,
|
|
|
5344
5364
|
if (t(e)) {
|
|
5345
5365
|
if (o.length === n) return {
|
|
5346
5366
|
items: o,
|
|
5347
|
-
nextCursor:
|
|
5367
|
+
nextCursor: El({
|
|
5348
5368
|
next: e.id,
|
|
5349
5369
|
state: a
|
|
5350
5370
|
})
|
|
@@ -5361,10 +5381,10 @@ async function El({ fetchPage: e, matches: t, limit: n, maxPageSize: r, from: i,
|
|
|
5361
5381
|
}
|
|
5362
5382
|
c = l;
|
|
5363
5383
|
}
|
|
5364
|
-
throw Error(`Stopped after reading ${
|
|
5384
|
+
throw Error(`Stopped after reading ${Sl * r} items without reaching the end of the list.`);
|
|
5365
5385
|
}
|
|
5366
5386
|
// src/tools/find-tasks.ts
|
|
5367
|
-
var { FIND_COMPLETED_TASKS:
|
|
5387
|
+
var { FIND_COMPLETED_TASKS: kl, ADD_TASKS: Al } = B, jl = {
|
|
5368
5388
|
searchText: p.string().optional().describe("The text to search for in tasks."),
|
|
5369
5389
|
projectId: p.string().optional().describe("Find tasks in this project. Project ID should be an ID string, or the text \"inbox\", for inbox tasks."),
|
|
5370
5390
|
sectionId: p.string().optional().describe("Find tasks in this section."),
|
|
@@ -5375,18 +5395,18 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5375
5395
|
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)."),
|
|
5376
5396
|
filter: p.string().optional().describe("A raw Todoist filter query string (e.g. \"today\", \"p1\", \"##Work\", \"(today | overdue) & p1\"). Combined with other filters using AND. Cannot be used with projectId, sectionId, parentId, or filterIdOrName."),
|
|
5377
5397
|
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
|
-
...
|
|
5379
|
-
},
|
|
5398
|
+
...sc
|
|
5399
|
+
}, Ml = {
|
|
5380
5400
|
tasks: p.array(J).describe("The found tasks."),
|
|
5381
5401
|
nextCursor: p.string().optional(),
|
|
5382
5402
|
totalCount: p.number().describe("The total number of tasks in this page."),
|
|
5383
5403
|
hasMore: p.boolean(),
|
|
5384
5404
|
appliedFilters: p.record(p.string(), p.unknown())
|
|
5385
|
-
},
|
|
5405
|
+
}, Nl = {
|
|
5386
5406
|
name: B.FIND_TASKS,
|
|
5387
5407
|
description: "Find active tasks by text, project/section/parent, responsible user, labels, raw filter, or saved filter (filterIdOrName). Without filters, list a page. Default scope: unassigned + mine; responsibleUserFiltering=\"all\" includes others.",
|
|
5388
|
-
parameters:
|
|
5389
|
-
outputSchema:
|
|
5408
|
+
parameters: jl,
|
|
5409
|
+
outputSchema: Ml,
|
|
5390
5410
|
annotations: {
|
|
5391
5411
|
readOnlyHint: !0,
|
|
5392
5412
|
destructiveHint: !1,
|
|
@@ -5397,8 +5417,8 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5397
5417
|
if (f && p) throw Error("The `filter` and `filterIdOrName` parameters cannot be used together. Provide only one.");
|
|
5398
5418
|
let h = !!(r || i || a);
|
|
5399
5419
|
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\").");
|
|
5400
|
-
let g = h ?
|
|
5401
|
-
p && (b = (await
|
|
5420
|
+
let g = h ? Dl(m) : void 0, _ = h ? g ? Promise.resolve(Fl(g.state)) : Il(t, u, d) : Promise.resolve(void 0), v = await t.getUser(), y = u && u.length > 0, b = f;
|
|
5421
|
+
p && (b = (await ds.resolveFilter(t, p)).filterQuery);
|
|
5402
5422
|
let x = await Ar(t, o), S = x?.userId, ee = x?.email;
|
|
5403
5423
|
if (h) {
|
|
5404
5424
|
let o = {};
|
|
@@ -5408,7 +5428,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5408
5428
|
})), i && (o.sectionId = i), a && (o.parentId = a);
|
|
5409
5429
|
let l = await _;
|
|
5410
5430
|
l && (o.label = l);
|
|
5411
|
-
let f = n?.toLowerCase(), { items: p, nextCursor: m } = await
|
|
5431
|
+
let f = n?.toLowerCase(), { items: p, nextCursor: m } = await Ol({
|
|
5412
5432
|
fetchPage: async (e) => {
|
|
5413
5433
|
let { results: n, nextCursor: r } = await t.getTasks({
|
|
5414
5434
|
...o,
|
|
@@ -5424,14 +5444,14 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5424
5444
|
resolvedAssigneeId: S,
|
|
5425
5445
|
currentUserId: v.id,
|
|
5426
5446
|
responsibleUserFiltering: s
|
|
5427
|
-
}).length === 1 && (!u?.length ||
|
|
5447
|
+
}).length === 1 && (!u?.length || dc(e.labels, u, d)),
|
|
5428
5448
|
limit: c,
|
|
5429
5449
|
maxPageSize: D.TASKS_PAGE_MAX,
|
|
5430
5450
|
from: g,
|
|
5431
5451
|
state: l ? { apiLabel: l } : void 0
|
|
5432
5452
|
});
|
|
5433
5453
|
return {
|
|
5434
|
-
textContent:
|
|
5454
|
+
textContent: Rl({
|
|
5435
5455
|
tasks: p,
|
|
5436
5456
|
args: e,
|
|
5437
5457
|
nextCursor: m,
|
|
@@ -5461,7 +5481,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5461
5481
|
cursor: m ?? null
|
|
5462
5482
|
}), a = r.map(K);
|
|
5463
5483
|
return {
|
|
5464
|
-
textContent:
|
|
5484
|
+
textContent: Rl({
|
|
5465
5485
|
tasks: a,
|
|
5466
5486
|
args: e,
|
|
5467
5487
|
nextCursor: i,
|
|
@@ -5480,7 +5500,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5480
5500
|
}
|
|
5481
5501
|
let C = b ? `(${b})` : "";
|
|
5482
5502
|
n && (C = jr(C, `search: ${ae(n)}`));
|
|
5483
|
-
let te =
|
|
5503
|
+
let te = lc(u, d);
|
|
5484
5504
|
if (C = jr(C, te), !p || o || s) {
|
|
5485
5505
|
let e = Mr({
|
|
5486
5506
|
resolvedAssigneeId: S,
|
|
@@ -5497,7 +5517,7 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5497
5517
|
limit: e.limit
|
|
5498
5518
|
});
|
|
5499
5519
|
return {
|
|
5500
|
-
textContent:
|
|
5520
|
+
textContent: Rl({
|
|
5501
5521
|
tasks: w,
|
|
5502
5522
|
args: e,
|
|
5503
5523
|
nextCursor: ne,
|
|
@@ -5514,18 +5534,18 @@ var { FIND_COMPLETED_TASKS: Dl, ADD_TASKS: Ol } = B, kl = {
|
|
|
5514
5534
|
}
|
|
5515
5535
|
};
|
|
5516
5536
|
}
|
|
5517
|
-
},
|
|
5518
|
-
function
|
|
5537
|
+
}, Pl = p.object({ apiLabel: p.string().optional() });
|
|
5538
|
+
function Fl(e) {
|
|
5519
5539
|
if (e === void 0) return;
|
|
5520
|
-
let t =
|
|
5521
|
-
if (!t.success) throw Error(
|
|
5540
|
+
let t = Pl.safeParse(e);
|
|
5541
|
+
if (!t.success) throw Error(wl);
|
|
5522
5542
|
return t.data.apiLabel;
|
|
5523
5543
|
}
|
|
5524
|
-
async function
|
|
5544
|
+
async function Il(e, t, n) {
|
|
5525
5545
|
if (!(!t?.length || t.length > 1 && n !== "and")) try {
|
|
5526
5546
|
let [n, r] = await Promise.all([Gr(e), Kr(e)]), i = [...n, ...r];
|
|
5527
5547
|
for (let e of t) {
|
|
5528
|
-
let t =
|
|
5548
|
+
let t = fc(e, i);
|
|
5529
5549
|
if (t) return t;
|
|
5530
5550
|
}
|
|
5531
5551
|
return;
|
|
@@ -5534,10 +5554,10 @@ async function Pl(e, t, n) {
|
|
|
5534
5554
|
return;
|
|
5535
5555
|
}
|
|
5536
5556
|
}
|
|
5537
|
-
function
|
|
5557
|
+
function Ll(e) {
|
|
5538
5558
|
if (e.projectId) {
|
|
5539
5559
|
let t = [e.searchText ? "No tasks in project match search" : "Project has no tasks yet"];
|
|
5540
|
-
return e.searchText || t.push(`Use ${
|
|
5560
|
+
return e.searchText || t.push(`Use ${Al} to create tasks`), t;
|
|
5541
5561
|
}
|
|
5542
5562
|
if (e.sectionId) {
|
|
5543
5563
|
let t = [e.searchText ? "No tasks in section match search" : "Section is empty"];
|
|
@@ -5545,11 +5565,11 @@ function Fl(e) {
|
|
|
5545
5565
|
}
|
|
5546
5566
|
if (e.parentId) {
|
|
5547
5567
|
let t = [e.searchText ? "No subtasks match search" : "No subtasks created yet"];
|
|
5548
|
-
return e.searchText || t.push(`Use ${
|
|
5568
|
+
return e.searchText || t.push(`Use ${Al} with parentId to add subtasks`), t;
|
|
5549
5569
|
}
|
|
5550
5570
|
return [];
|
|
5551
5571
|
}
|
|
5552
|
-
function
|
|
5572
|
+
function Rl({ tasks: e, args: t, nextCursor: n, isContainerSearch: r, assigneeEmail: i, assigneeNames: a }) {
|
|
5553
5573
|
let o = "Tasks", s = [], c = [];
|
|
5554
5574
|
if (r) {
|
|
5555
5575
|
if (t.projectId ? (o = "Tasks in project", s.push(`in project ${t.projectId}`)) : t.sectionId ? (o = "Tasks in section", s.push(`in section ${t.sectionId}`)) : t.parentId ? (o = "Subtasks", s.push(`subtasks of ${t.parentId}`)) : o = "Tasks", t.searchText && (o += ` matching "${t.searchText}"`, s.push(`containing "${t.searchText}"`)), t.responsibleUser) {
|
|
@@ -5557,26 +5577,26 @@ function Il({ tasks: e, args: t, nextCursor: n, isContainerSearch: r, assigneeEm
|
|
|
5557
5577
|
o += ` assigned to ${e}`, s.push(`assigned to ${e}`);
|
|
5558
5578
|
}
|
|
5559
5579
|
if (t.labels && t.labels.length > 0) {
|
|
5560
|
-
let e =
|
|
5580
|
+
let e = pc(t.labels, t.labelsOperator);
|
|
5561
5581
|
s.push(`labels: ${e}`);
|
|
5562
5582
|
}
|
|
5563
|
-
e.length === 0 && c.push(...
|
|
5583
|
+
e.length === 0 && c.push(...Ll(t));
|
|
5564
5584
|
} else {
|
|
5565
5585
|
let n = i || t.responsibleUser, r = [];
|
|
5566
5586
|
if (t.filter && r.push(`filter: ${t.filter}`), t.searchText && r.push(`"${t.searchText}"`), t.responsibleUser && r.push(`assigned to ${n}`), t.labels && t.labels.length > 0) {
|
|
5567
|
-
let e =
|
|
5587
|
+
let e = pc(t.labels, t.labelsOperator);
|
|
5568
5588
|
r.push(`with labels: ${e}`);
|
|
5569
5589
|
}
|
|
5570
|
-
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (o = `Tasks matching filter: ${t.filter}`, s.push(`filter: ${t.filter}`)) : t.searchText ? (o = `Search results for ${r.join(" ")}`, s.push(`matching "${t.searchText}"`), t.filter && s.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (o = `Tasks assigned to ${n}`, t.filter && s.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (o = `Tasks with labels: ${
|
|
5571
|
-
let e =
|
|
5590
|
+
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (o = `Tasks matching filter: ${t.filter}`, s.push(`filter: ${t.filter}`)) : t.searchText ? (o = `Search results for ${r.join(" ")}`, s.push(`matching "${t.searchText}"`), t.filter && s.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (o = `Tasks assigned to ${n}`, t.filter && s.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (o = `Tasks with labels: ${pc(t.labels, t.labelsOperator)}`, t.filter && s.push(`filter: ${t.filter}`)) : o = `Tasks ${r.join(" ")}`, t.responsibleUser && s.push(`assigned to ${n}`), t.labels && t.labels.length > 0) {
|
|
5591
|
+
let e = pc(t.labels, t.labelsOperator);
|
|
5572
5592
|
s.push(`labels: ${e}`);
|
|
5573
5593
|
}
|
|
5574
5594
|
if (e.length === 0) {
|
|
5575
5595
|
if (t.responsibleUser) {
|
|
5576
5596
|
let e = i || t.responsibleUser;
|
|
5577
|
-
c.push(`No tasks assigned to ${e}`), c.push("Check if the user name is correct"), c.push(`Check completed tasks with ${
|
|
5597
|
+
c.push(`No tasks assigned to ${e}`), c.push("Check if the user name is correct"), c.push(`Check completed tasks with ${kl}`);
|
|
5578
5598
|
}
|
|
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 ${
|
|
5599
|
+
t.searchText && (c.push("Try broader search terms"), c.push("Verify spelling and try partial words"), t.responsibleUser || c.push(`Check completed tasks with ${kl}`));
|
|
5580
5600
|
}
|
|
5581
5601
|
}
|
|
5582
5602
|
return Z({
|
|
@@ -5590,7 +5610,7 @@ function Il({ tasks: e, args: t, nextCursor: n, isContainerSearch: r, assigneeEm
|
|
|
5590
5610
|
});
|
|
5591
5611
|
}
|
|
5592
5612
|
// src/tools/find-templates.ts
|
|
5593
|
-
var
|
|
5613
|
+
var zl = {
|
|
5594
5614
|
query: p.string().trim().min(1).optional().describe("Words to search template names and descriptions for, e.g. \"launch\"."),
|
|
5595
5615
|
source: p.enum([
|
|
5596
5616
|
"all",
|
|
@@ -5601,7 +5621,7 @@ var Ll = {
|
|
|
5601
5621
|
locale: p.string().optional().describe("Language of gallery template content, e.g. \"de\". Defaults to \"en\"."),
|
|
5602
5622
|
limit: p.number().int().min(1).max(D.TEMPLATES_MAX).optional().describe(`Defaults to ${D.TEMPLATES_DEFAULT}.`),
|
|
5603
5623
|
cursor: p.string().optional().describe("A previous result's `nextCursor`, for the next page.")
|
|
5604
|
-
},
|
|
5624
|
+
}, Bl = {
|
|
5605
5625
|
templates: p.array(p.object({
|
|
5606
5626
|
templateId: p.string(),
|
|
5607
5627
|
name: p.string(),
|
|
@@ -5609,11 +5629,11 @@ var Ll = {
|
|
|
5609
5629
|
...Ei
|
|
5610
5630
|
})),
|
|
5611
5631
|
nextCursor: p.string().optional().describe("Absent on the last page.")
|
|
5612
|
-
},
|
|
5632
|
+
}, Vl = {
|
|
5613
5633
|
name: B.FIND_TEMPLATES,
|
|
5614
5634
|
description: "Search the Todoist gallery's project templates and the user's personal and workspace ones, to find a template's ID for add-projects, import-into-project, fetch-object or update-template.",
|
|
5615
|
-
parameters:
|
|
5616
|
-
outputSchema:
|
|
5635
|
+
parameters: zl,
|
|
5636
|
+
outputSchema: Bl,
|
|
5617
5637
|
annotations: {
|
|
5618
5638
|
readOnlyHint: !0,
|
|
5619
5639
|
destructiveHint: !1,
|
|
@@ -5629,7 +5649,7 @@ var Ll = {
|
|
|
5629
5649
|
limit: r
|
|
5630
5650
|
});
|
|
5631
5651
|
return {
|
|
5632
|
-
textContent:
|
|
5652
|
+
textContent: Hl({
|
|
5633
5653
|
templates: o,
|
|
5634
5654
|
query: e,
|
|
5635
5655
|
nextCursor: s
|
|
@@ -5647,25 +5667,25 @@ var Ll = {
|
|
|
5647
5667
|
};
|
|
5648
5668
|
}
|
|
5649
5669
|
};
|
|
5650
|
-
function
|
|
5670
|
+
function Hl({ templates: e, query: t, nextCursor: n }) {
|
|
5651
5671
|
let r = t ? ` matching "${t}"` : "";
|
|
5652
5672
|
if (e.length === 0) return `No templates found${r}.`;
|
|
5653
|
-
let i = e.map((e) => `- ${e.name} (id=${e.id}, ${
|
|
5673
|
+
let i = e.map((e) => `- ${e.name} (id=${e.id}, ${Ul(e)}): ${e.shortDescription}`), a = n ? `\n${zi([], n)}` : "";
|
|
5654
5674
|
return `Found ${e.length} template${e.length === 1 ? "" : "s"}${r}:\n${i.join("\n")}${a}`;
|
|
5655
5675
|
}
|
|
5656
|
-
function
|
|
5676
|
+
function Ul(e) {
|
|
5657
5677
|
return e.templateSource === "todoist" ? "gallery" : e.workspaceId ? `workspace ${e.workspaceId}` : "personal";
|
|
5658
5678
|
}
|
|
5659
5679
|
// src/tools/get-overview.ts
|
|
5660
|
-
var
|
|
5680
|
+
var Wl = { projectId: p.string().min(1).optional().describe("Optional project ID. Use \"inbox\" for the Inbox. If provided, returns that project's tasks grouped by section. If omitted, returns the project and section structure for the whole account with no tasks.") }, Gl = p.lazy(() => p.object({
|
|
5661
5681
|
id: p.string().describe("The project ID."),
|
|
5662
5682
|
name: p.string().describe("The project name."),
|
|
5663
5683
|
parentId: p.string().optional().describe("The parent project ID (for sub-projects, personal projects only)."),
|
|
5664
5684
|
folderId: p.string().optional().describe("The folder ID this project belongs to (workspace projects only)."),
|
|
5665
5685
|
childOrder: p.number().describe("The ordering index among siblings."),
|
|
5666
5686
|
sections: p.array(hi),
|
|
5667
|
-
children: p.array(
|
|
5668
|
-
})),
|
|
5687
|
+
children: p.array(Gl).describe("Nested child projects.")
|
|
5688
|
+
})), Kl = {
|
|
5669
5689
|
type: p.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
|
|
5670
5690
|
totalProjects: p.number().optional().describe("Total number of projects (account overview only)."),
|
|
5671
5691
|
totalTasks: p.number().optional().describe("Total number of tasks."),
|
|
@@ -5683,7 +5703,7 @@ var Hl = { projectId: p.string().min(1).optional().describe("Optional project ID
|
|
|
5683
5703
|
name: p.string().describe("The inbox project name."),
|
|
5684
5704
|
sections: p.array(hi).describe("Sections in the inbox project.")
|
|
5685
5705
|
}).optional().describe("Inbox information (account overview only)."),
|
|
5686
|
-
projects: p.array(p.lazy(() =>
|
|
5706
|
+
projects: p.array(p.lazy(() => Gl)).optional().describe("List of projects with hierarchy, folders, and ordering (account overview only)."),
|
|
5687
5707
|
project: p.object({
|
|
5688
5708
|
id: p.string().describe("The project ID."),
|
|
5689
5709
|
name: p.string().describe("The project name.")
|
|
@@ -5696,7 +5716,7 @@ var Hl = { projectId: p.string().min(1).optional().describe("Optional project ID
|
|
|
5696
5716
|
tasksWithoutSection: p.number()
|
|
5697
5717
|
}).optional().describe("Statistics object (project overview only).")
|
|
5698
5718
|
};
|
|
5699
|
-
function
|
|
5719
|
+
function ql(e) {
|
|
5700
5720
|
let t = {};
|
|
5701
5721
|
for (let n of e) t[n.id] = {
|
|
5702
5722
|
...n,
|
|
@@ -5719,22 +5739,22 @@ function Gl(e) {
|
|
|
5719
5739
|
}
|
|
5720
5740
|
return r(n), n;
|
|
5721
5741
|
}
|
|
5722
|
-
async function
|
|
5742
|
+
async function Jl(e, t) {
|
|
5723
5743
|
let n = {};
|
|
5724
5744
|
return await Promise.all(t.map(async (t) => {
|
|
5725
5745
|
let { results: r } = await e.getSections({ projectId: t });
|
|
5726
5746
|
n[t] = r;
|
|
5727
5747
|
})), n;
|
|
5728
5748
|
}
|
|
5729
|
-
function
|
|
5749
|
+
function Yl(e, t, n = "") {
|
|
5730
5750
|
let r = [];
|
|
5731
5751
|
r.push(`${n}- Project: ${e.name} (id=${e.id})`);
|
|
5732
5752
|
let i = t[e.id] || [];
|
|
5733
5753
|
for (let e of i) r.push(`${n} - Section: ${e.name} (id=${e.id})`);
|
|
5734
|
-
for (let i of e.children) r.push(...
|
|
5754
|
+
for (let i of e.children) r.push(...Yl(i, t, `${n} `));
|
|
5735
5755
|
return r;
|
|
5736
5756
|
}
|
|
5737
|
-
function
|
|
5757
|
+
function Xl(e) {
|
|
5738
5758
|
let t = {};
|
|
5739
5759
|
for (let n of e) t[n.id] = {
|
|
5740
5760
|
...n,
|
|
@@ -5753,15 +5773,15 @@ function Jl(e) {
|
|
|
5753
5773
|
}
|
|
5754
5774
|
return n;
|
|
5755
5775
|
}
|
|
5756
|
-
function
|
|
5776
|
+
function Zl(e, t, n = "") {
|
|
5757
5777
|
let r = [];
|
|
5758
5778
|
for (let i of e) {
|
|
5759
5779
|
let e = `id=${i.id}`, a = i.dueDate ? `; due=${i.dueDate}` : "", o = i.responsibleUid ? `; assignee=${t.get(i.responsibleUid) ?? i.responsibleUid}` : "", s = `; content=${i.content}`;
|
|
5760
|
-
r.push(`${n}- ${e}${a}${o}${s}`), i.children.length > 0 && r.push(...
|
|
5780
|
+
r.push(`${n}- ${e}${a}${o}${s}`), i.children.length > 0 && r.push(...Zl(i.children, t, `${n} `));
|
|
5761
5781
|
}
|
|
5762
5782
|
return r;
|
|
5763
5783
|
}
|
|
5764
|
-
function
|
|
5784
|
+
function Ql(e, t) {
|
|
5765
5785
|
return {
|
|
5766
5786
|
id: e.id,
|
|
5767
5787
|
name: e.name,
|
|
@@ -5769,10 +5789,10 @@ function Xl(e, t) {
|
|
|
5769
5789
|
folderId: de(e) ? e.folderId ?? void 0 : void 0,
|
|
5770
5790
|
childOrder: e.childOrder,
|
|
5771
5791
|
sections: (t[e.id] || []).map(gi),
|
|
5772
|
-
children: e.children.map((e) =>
|
|
5792
|
+
children: e.children.map((e) => Ql(e, t))
|
|
5773
5793
|
};
|
|
5774
5794
|
}
|
|
5775
|
-
async function
|
|
5795
|
+
async function $l(e, t) {
|
|
5776
5796
|
let n = [], r;
|
|
5777
5797
|
do {
|
|
5778
5798
|
let { results: i, nextCursor: a } = await e.getTasks({
|
|
@@ -5784,17 +5804,17 @@ async function Zl(e, t) {
|
|
|
5784
5804
|
} while (r);
|
|
5785
5805
|
return n;
|
|
5786
5806
|
}
|
|
5787
|
-
async function
|
|
5807
|
+
async function eu(e, t) {
|
|
5788
5808
|
let { results: n } = await e.getSections({ projectId: t });
|
|
5789
5809
|
return n;
|
|
5790
5810
|
}
|
|
5791
|
-
async function
|
|
5792
|
-
let { results: t } = await e.getProjects({}), n = t.find((e) => le(e) && e.inboxProject === !0), r =
|
|
5811
|
+
async function tu(e) {
|
|
5812
|
+
let { results: t } = await e.getProjects({}), n = t.find((e) => le(e) && e.inboxProject === !0), r = ql(t.filter((e) => !le(e) || e.inboxProject !== !0)), i = t.map((e) => e.id), a = await Jl(e, i), o = ["# Personal Projects", ""];
|
|
5793
5813
|
if (n) {
|
|
5794
5814
|
o.push(`- Inbox Project: ${n.name} (id=${n.id})`);
|
|
5795
5815
|
for (let e of a[n.id] || []) o.push(` - Section: ${e.name} (id=${e.id})`);
|
|
5796
5816
|
}
|
|
5797
|
-
if (r.length) for (let e of r) o.push(...
|
|
5817
|
+
if (r.length) for (let e of r) o.push(...Yl(e, a));
|
|
5798
5818
|
else o.push("_No projects found._");
|
|
5799
5819
|
o.push(""), o.push(`_Note: This overview lists projects and sections only; tasks are not included. Call ${B.GET_OVERVIEW} with a projectId (or "inbox") to see a project's tasks._`, "");
|
|
5800
5820
|
let s = r.some((e) => e.children.length > 0);
|
|
@@ -5807,20 +5827,20 @@ async function $l(e) {
|
|
|
5807
5827
|
name: n.name,
|
|
5808
5828
|
sections: (a[n.id] || []).map(gi)
|
|
5809
5829
|
} : void 0,
|
|
5810
|
-
projects: r.map((e) =>
|
|
5830
|
+
projects: r.map((e) => Ql(e, a)),
|
|
5811
5831
|
totalProjects: t.length,
|
|
5812
5832
|
totalSections: i.reduce((e, t) => e + (a[t]?.length || 0), 0),
|
|
5813
5833
|
hasNestedProjects: s
|
|
5814
5834
|
}
|
|
5815
5835
|
};
|
|
5816
5836
|
}
|
|
5817
|
-
async function
|
|
5837
|
+
async function nu(e, t) {
|
|
5818
5838
|
let n = G(e, t), r = (e) => e.catch(async (e) => {
|
|
5819
5839
|
throw await n, e;
|
|
5820
5840
|
}), [i, a, o] = await Promise.all([
|
|
5821
5841
|
n,
|
|
5822
|
-
r(
|
|
5823
|
-
r(
|
|
5842
|
+
r(eu(e, t)),
|
|
5843
|
+
r($l(e, t))
|
|
5824
5844
|
]), s = await Er(e, o), c = {};
|
|
5825
5845
|
for (let e of a) c[e.id] = [];
|
|
5826
5846
|
let l = [];
|
|
@@ -5828,15 +5848,15 @@ async function eu(e, t) {
|
|
|
5828
5848
|
let u = [`# ${i.name}`];
|
|
5829
5849
|
if (l.length > 0) {
|
|
5830
5850
|
u.push("");
|
|
5831
|
-
let e =
|
|
5832
|
-
u.push(...
|
|
5851
|
+
let e = Xl(l);
|
|
5852
|
+
u.push(...Zl(e, s));
|
|
5833
5853
|
}
|
|
5834
5854
|
for (let e of a) {
|
|
5835
5855
|
u.push(""), u.push(`## ${e.name}`);
|
|
5836
5856
|
let t = c[e.id];
|
|
5837
5857
|
if (!t?.length) continue;
|
|
5838
|
-
let n =
|
|
5839
|
-
u.push(...
|
|
5858
|
+
let n = Xl(t);
|
|
5859
|
+
u.push(...Zl(n, s));
|
|
5840
5860
|
}
|
|
5841
5861
|
return {
|
|
5842
5862
|
textContent: u.join("\n"),
|
|
@@ -5859,11 +5879,11 @@ async function eu(e, t) {
|
|
|
5859
5879
|
}
|
|
5860
5880
|
};
|
|
5861
5881
|
}
|
|
5862
|
-
var
|
|
5882
|
+
var ru = {
|
|
5863
5883
|
name: B.GET_OVERVIEW,
|
|
5864
5884
|
description: "Get a Markdown overview. Called without a projectId, returns the account's project and section structure only — no tasks — for navigation. Pass a projectId (or \"inbox\" for the Inbox) to get that project's tasks grouped by section.",
|
|
5865
|
-
parameters:
|
|
5866
|
-
outputSchema:
|
|
5885
|
+
parameters: Wl,
|
|
5886
|
+
outputSchema: Kl,
|
|
5867
5887
|
annotations: {
|
|
5868
5888
|
readOnlyHint: !0,
|
|
5869
5889
|
destructiveHint: !1,
|
|
@@ -5873,41 +5893,41 @@ var tu = {
|
|
|
5873
5893
|
let n = await Pr({
|
|
5874
5894
|
projectId: e.projectId,
|
|
5875
5895
|
client: t
|
|
5876
|
-
}), r = n ? await
|
|
5896
|
+
}), r = n ? await nu(t, n) : await tu(t);
|
|
5877
5897
|
return {
|
|
5878
5898
|
textContent: r.textContent,
|
|
5879
5899
|
structuredContent: r.structuredContent
|
|
5880
5900
|
};
|
|
5881
5901
|
}
|
|
5882
|
-
},
|
|
5902
|
+
}, iu = {}, au = p.object({
|
|
5883
5903
|
count: p.number().describe("Number of consecutive periods in this streak."),
|
|
5884
5904
|
start: p.string().describe("Start date of the streak."),
|
|
5885
5905
|
end: p.string().describe("End date of the streak.")
|
|
5886
|
-
}),
|
|
5906
|
+
}), ou = p.object({
|
|
5887
5907
|
id: p.string().describe("Project ID."),
|
|
5888
5908
|
completed: p.number().describe("Number of tasks completed in this project.")
|
|
5889
|
-
}),
|
|
5909
|
+
}), su = {
|
|
5890
5910
|
completedCount: p.number().describe("Total number of completed tasks (all-time)."),
|
|
5891
5911
|
daysItems: p.array(p.object({
|
|
5892
5912
|
date: p.string().describe("Date string (YYYY-MM-DD)."),
|
|
5893
5913
|
totalCompleted: p.number().describe("Total tasks completed on this day."),
|
|
5894
|
-
items: p.array(
|
|
5914
|
+
items: p.array(ou).describe("Per-project completion breakdown for this day.")
|
|
5895
5915
|
})).describe("Daily completion breakdown (most recent days)."),
|
|
5896
5916
|
weekItems: p.array(p.object({
|
|
5897
5917
|
from: p.string().describe("Start date of the week."),
|
|
5898
5918
|
to: p.string().describe("End date of the week."),
|
|
5899
5919
|
totalCompleted: p.number().describe("Total tasks completed in this week."),
|
|
5900
|
-
items: p.array(
|
|
5920
|
+
items: p.array(ou).describe("Per-project completion breakdown for this week.")
|
|
5901
5921
|
})).describe("Weekly completion breakdown (most recent weeks)."),
|
|
5902
5922
|
goals: p.object({
|
|
5903
5923
|
dailyGoal: p.number().describe("Daily task completion goal."),
|
|
5904
5924
|
weeklyGoal: p.number().describe("Weekly task completion goal."),
|
|
5905
|
-
currentDailyStreak:
|
|
5906
|
-
currentWeeklyStreak:
|
|
5907
|
-
lastDailyStreak:
|
|
5908
|
-
lastWeeklyStreak:
|
|
5909
|
-
maxDailyStreak:
|
|
5910
|
-
maxWeeklyStreak:
|
|
5925
|
+
currentDailyStreak: au.describe("Current daily goal streak."),
|
|
5926
|
+
currentWeeklyStreak: au.describe("Current weekly goal streak."),
|
|
5927
|
+
lastDailyStreak: au.describe("Previous daily goal streak."),
|
|
5928
|
+
lastWeeklyStreak: au.describe("Previous weekly goal streak."),
|
|
5929
|
+
maxDailyStreak: au.describe("Best daily goal streak ever."),
|
|
5930
|
+
maxWeeklyStreak: au.describe("Best weekly goal streak ever."),
|
|
5911
5931
|
vacationMode: p.boolean().describe("Whether vacation mode is enabled."),
|
|
5912
5932
|
karmaDisabled: p.boolean().describe("Whether karma tracking is disabled.")
|
|
5913
5933
|
}).describe("Goal and streak information."),
|
|
@@ -5927,11 +5947,11 @@ var tu = {
|
|
|
5927
5947
|
negativeKarmaReasons: p.array(p.any()).describe("Reasons for negative karma.")
|
|
5928
5948
|
})).describe("Recent karma change events with reasons."),
|
|
5929
5949
|
projectColors: p.record(p.string(), p.string()).describe("Map of project ID to color key.")
|
|
5930
|
-
},
|
|
5950
|
+
}, cu = {
|
|
5931
5951
|
name: B.GET_PRODUCTIVITY_STATS,
|
|
5932
5952
|
description: "Get comprehensive productivity statistics including daily/weekly completion breakdowns, goal streaks (current, last, max), karma score and trends, and historical karma data. Useful for productivity analysis and tracking goal progress. Reports counts, streaks and karma only, never the tasks themselves — for \"what did I complete\", use find-activity.",
|
|
5933
|
-
parameters:
|
|
5934
|
-
outputSchema:
|
|
5953
|
+
parameters: iu,
|
|
5954
|
+
outputSchema: su,
|
|
5935
5955
|
annotations: {
|
|
5936
5956
|
readOnlyHint: !0,
|
|
5937
5957
|
destructiveHint: !1,
|
|
@@ -5940,7 +5960,7 @@ var tu = {
|
|
|
5940
5960
|
async execute(e, t) {
|
|
5941
5961
|
let n = await t.getProductivityStats();
|
|
5942
5962
|
return {
|
|
5943
|
-
textContent:
|
|
5963
|
+
textContent: lu(n),
|
|
5944
5964
|
structuredContent: {
|
|
5945
5965
|
completedCount: n.completedCount,
|
|
5946
5966
|
daysItems: n.daysItems,
|
|
@@ -5967,7 +5987,7 @@ var tu = {
|
|
|
5967
5987
|
};
|
|
5968
5988
|
}
|
|
5969
5989
|
};
|
|
5970
|
-
function
|
|
5990
|
+
function lu(e) {
|
|
5971
5991
|
let t = [
|
|
5972
5992
|
"# Productivity Statistics",
|
|
5973
5993
|
"",
|
|
@@ -5995,11 +6015,11 @@ function su(e) {
|
|
|
5995
6015
|
return t.join("\n");
|
|
5996
6016
|
}
|
|
5997
6017
|
// src/tools/get-project-activity-stats.ts
|
|
5998
|
-
var
|
|
6018
|
+
var uu = {
|
|
5999
6019
|
projectId: p.string().min(1).describe("The ID of the project to get activity stats for."),
|
|
6000
6020
|
weeks: p.number().int().min(1).max(12).optional().describe("Number of weeks of activity data to retrieve (1-12, default 2)."),
|
|
6001
6021
|
includeWeeklyCounts: p.boolean().optional().describe("Include weekly rollup counts alongside daily counts.")
|
|
6002
|
-
},
|
|
6022
|
+
}, du = {
|
|
6003
6023
|
projectId: p.string().describe("The project ID."),
|
|
6004
6024
|
dayItems: p.array(p.object({
|
|
6005
6025
|
date: p.string().describe("Date in ISO format."),
|
|
@@ -6011,7 +6031,7 @@ var cu = {
|
|
|
6011
6031
|
totalCount: p.number().describe("Number of tasks completed in this week.")
|
|
6012
6032
|
})).optional().describe("Weekly completion rollups. Only included when includeWeeklyCounts is true.")
|
|
6013
6033
|
};
|
|
6014
|
-
function
|
|
6034
|
+
function fu(e, t) {
|
|
6015
6035
|
let n = [`# Activity Stats: Project ${e}`, ""];
|
|
6016
6036
|
if (t.dayItems.length > 0) {
|
|
6017
6037
|
n.push("## Daily Activity");
|
|
@@ -6023,11 +6043,11 @@ function uu(e, t) {
|
|
|
6023
6043
|
}
|
|
6024
6044
|
return n.join("\n");
|
|
6025
6045
|
}
|
|
6026
|
-
var
|
|
6046
|
+
var pu = {
|
|
6027
6047
|
name: B.GET_PROJECT_ACTIVITY_STATS,
|
|
6028
6048
|
description: "Get daily and optional weekly task completion counts for a project over a configurable time window (1-12 weeks). Useful for identifying completion trends and patterns.",
|
|
6029
|
-
parameters:
|
|
6030
|
-
outputSchema:
|
|
6049
|
+
parameters: uu,
|
|
6050
|
+
outputSchema: du,
|
|
6031
6051
|
annotations: {
|
|
6032
6052
|
readOnlyHint: !0,
|
|
6033
6053
|
destructiveHint: !1,
|
|
@@ -6039,7 +6059,7 @@ var du = {
|
|
|
6039
6059
|
includeWeeklyCounts: i
|
|
6040
6060
|
});
|
|
6041
6061
|
return {
|
|
6042
|
-
textContent:
|
|
6062
|
+
textContent: fu(n, a),
|
|
6043
6063
|
structuredContent: {
|
|
6044
6064
|
projectId: n,
|
|
6045
6065
|
dayItems: a.dayItems,
|
|
@@ -6047,7 +6067,7 @@ var du = {
|
|
|
6047
6067
|
}
|
|
6048
6068
|
};
|
|
6049
6069
|
}
|
|
6050
|
-
},
|
|
6070
|
+
}, mu = { projectId: p.string().min(1).describe("The ID of the project to check health for.") }, hu = {
|
|
6051
6071
|
projectId: p.string().describe("The project ID."),
|
|
6052
6072
|
projectName: p.string().describe("The project name."),
|
|
6053
6073
|
progress: p.object({
|
|
@@ -6064,15 +6084,15 @@ var du = {
|
|
|
6064
6084
|
updatedAt: p.string().optional().describe("When the health assessment was last updated.")
|
|
6065
6085
|
}).describe("Project health assessment.")
|
|
6066
6086
|
};
|
|
6067
|
-
function
|
|
6087
|
+
function gu(e, t, n) {
|
|
6068
6088
|
let r = [`# Project Health: ${e}`, ""];
|
|
6069
6089
|
return r.push(`**Status:** ${n.status}`), n.isStale && r.push("**Note:** Health data is stale and may not reflect recent changes."), n.updateInProgress && r.push("**Note:** A health analysis update is currently in progress."), n.updatedAt && r.push(`**Last Updated:** ${n.updatedAt.toISOString()}`), r.push(""), r.push("## Progress"), r.push(`**Completed:** ${t.completedCount} | **Active:** ${t.activeCount} | **Progress:** ${t.progressPercent}%`), n.description && (r.push(""), r.push("## Health Description"), r.push(n.description)), r.join("\n");
|
|
6070
6090
|
}
|
|
6071
|
-
var
|
|
6091
|
+
var _u = {
|
|
6072
6092
|
name: B.GET_PROJECT_HEALTH,
|
|
6073
6093
|
description: "Get a comprehensive health assessment for a project including completion progress, health status (EXCELLENT, ON_TRACK, AT_RISK, CRITICAL), and a written assessment. Use find-tasks and find-completed-tasks for task-level detail.",
|
|
6074
|
-
parameters:
|
|
6075
|
-
outputSchema:
|
|
6094
|
+
parameters: mu,
|
|
6095
|
+
outputSchema: hu,
|
|
6076
6096
|
annotations: {
|
|
6077
6097
|
readOnlyHint: !0,
|
|
6078
6098
|
destructiveHint: !1,
|
|
@@ -6081,7 +6101,7 @@ var hu = {
|
|
|
6081
6101
|
async execute(e, t) {
|
|
6082
6102
|
let { projectId: n } = e, [r, i] = await Promise.all([t.getProjectProgress(n), t.getProjectHealth(n)]), a = `Project ${n}`;
|
|
6083
6103
|
return {
|
|
6084
|
-
textContent:
|
|
6104
|
+
textContent: gu(a, r, i),
|
|
6085
6105
|
structuredContent: {
|
|
6086
6106
|
projectId: n,
|
|
6087
6107
|
projectName: a,
|
|
@@ -6101,27 +6121,27 @@ var hu = {
|
|
|
6101
6121
|
}
|
|
6102
6122
|
};
|
|
6103
6123
|
}
|
|
6104
|
-
},
|
|
6124
|
+
}, vu = p.object({
|
|
6105
6125
|
message: p.string().optional(),
|
|
6106
6126
|
emoji: p.string().optional(),
|
|
6107
6127
|
activeUntil: p.string().optional().describe("ISO 8601 end. Omitted when it has no end."),
|
|
6108
6128
|
pauseNotifications: p.boolean().describe("Comms notifications held back."),
|
|
6109
6129
|
pauseActivity: p.boolean().describe("Karma and streaks paused.")
|
|
6110
|
-
}),
|
|
6130
|
+
}), yu = {
|
|
6111
6131
|
hasStatus: p.boolean(),
|
|
6112
|
-
status:
|
|
6132
|
+
status: vu.optional().describe("Omitted when there is no active status.")
|
|
6113
6133
|
};
|
|
6114
|
-
function
|
|
6134
|
+
function bu(e) {
|
|
6115
6135
|
if (!e.user) throw Error("Todoist did not return the user, so the status is unknown.");
|
|
6116
6136
|
return e.user.status ?? null;
|
|
6117
6137
|
}
|
|
6118
|
-
async function
|
|
6119
|
-
return
|
|
6138
|
+
async function xu(e) {
|
|
6139
|
+
return bu(await R(() => e.sync({
|
|
6120
6140
|
resourceTypes: ["user"],
|
|
6121
6141
|
syncToken: "*"
|
|
6122
6142
|
})));
|
|
6123
6143
|
}
|
|
6124
|
-
function
|
|
6144
|
+
function Su(e) {
|
|
6125
6145
|
let t = e.activeUntil ? new Date(e.activeUntil).toISOString() : void 0;
|
|
6126
6146
|
return {
|
|
6127
6147
|
...e.message ? { message: e.message } : {},
|
|
@@ -6131,12 +6151,12 @@ function bu(e) {
|
|
|
6131
6151
|
pauseActivity: !!e.effects?.pauseActivity
|
|
6132
6152
|
};
|
|
6133
6153
|
}
|
|
6134
|
-
function
|
|
6154
|
+
function Cu(e, t) {
|
|
6135
6155
|
if (!e) return {
|
|
6136
6156
|
textContent: `${t}: none`,
|
|
6137
6157
|
structuredContent: { hasStatus: !1 }
|
|
6138
6158
|
};
|
|
6139
|
-
let n =
|
|
6159
|
+
let n = Su(e), r = [`${t}: ${[n.emoji, n.message].filter(Boolean).join(" ")}`];
|
|
6140
6160
|
r.push(n.activeUntil ? `Until: ${n.activeUntil}` : "Until: no end");
|
|
6141
6161
|
let i = [n.pauseNotifications ? "Comms notifications paused" : void 0, n.pauseActivity ? "Karma and streaks paused" : void 0].filter((e) => e !== void 0);
|
|
6142
6162
|
return i.length > 0 && r.push(`Effects: ${i.join(", ")}`), {
|
|
@@ -6148,23 +6168,23 @@ function xu(e, t) {
|
|
|
6148
6168
|
};
|
|
6149
6169
|
}
|
|
6150
6170
|
// src/tools/get-user-status.ts
|
|
6151
|
-
var
|
|
6171
|
+
var wu = {
|
|
6152
6172
|
name: B.GET_USER_STATUS,
|
|
6153
6173
|
description: "Get the user's status, the message and emoji shown next to their name in Todoist and Comms, with when it ends and whether it pauses Comms notifications or Karma and streaks. Returns no status when none is set or it has expired.",
|
|
6154
6174
|
parameters: {},
|
|
6155
|
-
outputSchema:
|
|
6175
|
+
outputSchema: yu,
|
|
6156
6176
|
annotations: {
|
|
6157
6177
|
readOnlyHint: !0,
|
|
6158
6178
|
destructiveHint: !1,
|
|
6159
6179
|
idempotentHint: !0
|
|
6160
6180
|
},
|
|
6161
6181
|
async execute(e, t) {
|
|
6162
|
-
return
|
|
6182
|
+
return Cu(await xu(t), "Status");
|
|
6163
6183
|
}
|
|
6164
|
-
},
|
|
6184
|
+
}, Tu = {
|
|
6165
6185
|
workspaceIdOrName: p.string().min(1).describe("The workspace ID or name. Supports exact ID, exact name match (case-insensitive), or unique partial name match."),
|
|
6166
6186
|
projectIds: p.array(p.string().min(1)).min(1).max(D.FILTER_VALUES_MAX).optional().describe("Optional list of project IDs to scope insights to specific projects.")
|
|
6167
|
-
},
|
|
6187
|
+
}, Eu = p.object({
|
|
6168
6188
|
projectId: p.string().describe("The project ID."),
|
|
6169
6189
|
health: p.object({
|
|
6170
6190
|
status: p.enum(v).describe("The health status of the project."),
|
|
@@ -6176,15 +6196,15 @@ var Su = {
|
|
|
6176
6196
|
activeCount: p.number().describe("Number of active tasks."),
|
|
6177
6197
|
progressPercent: p.number().describe("Completion percentage (0-100).")
|
|
6178
6198
|
}).optional().describe("Progress data for this project. Omitted when the project has none.")
|
|
6179
|
-
}),
|
|
6199
|
+
}), Du = {
|
|
6180
6200
|
workspaceId: p.string().describe("The resolved workspace ID."),
|
|
6181
6201
|
workspaceName: p.string().describe("The resolved workspace name."),
|
|
6182
|
-
projectInsights: p.array(
|
|
6183
|
-
},
|
|
6202
|
+
projectInsights: p.array(Eu).describe("Health and progress insights for each project in the workspace.")
|
|
6203
|
+
}, Ou = {
|
|
6184
6204
|
name: B.GET_WORKSPACE_INSIGHTS,
|
|
6185
6205
|
description: "Get aggregated health and progress insights across all projects in a workspace. Accepts workspace name or ID, with optional project ID filtering. Useful for a cross-project health overview.",
|
|
6186
|
-
parameters:
|
|
6187
|
-
outputSchema:
|
|
6206
|
+
parameters: Tu,
|
|
6207
|
+
outputSchema: Du,
|
|
6188
6208
|
annotations: {
|
|
6189
6209
|
readOnlyHint: !0,
|
|
6190
6210
|
destructiveHint: !1,
|
|
@@ -6222,21 +6242,21 @@ var Su = {
|
|
|
6222
6242
|
}
|
|
6223
6243
|
};
|
|
6224
6244
|
}
|
|
6225
|
-
},
|
|
6245
|
+
}, ku = {
|
|
6226
6246
|
projectId: p.string().min(1).describe("The ID of the existing project to import into."),
|
|
6227
6247
|
templateId: p.string().regex(Ca, { error: wa }).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
6248
|
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
6249
|
locale: p.string().optional().describe("Locale for a template's content. Defaults to \"en\".")
|
|
6230
|
-
},
|
|
6250
|
+
}, Au = {
|
|
6231
6251
|
sections: p.array(hi).describe("Sections created by the import."),
|
|
6232
6252
|
tasks: p.array(J).describe("Tasks created by the import."),
|
|
6233
6253
|
comments: p.array(bi).describe("Comments created by the import."),
|
|
6234
6254
|
totalCount: p.number().describe("The total number of objects created by the import.")
|
|
6235
6255
|
};
|
|
6236
|
-
function
|
|
6256
|
+
function ju({ projectId: e, source: t, result: n }) {
|
|
6237
6257
|
let r = n.sections.map(gi), i = n.tasks.map(K), a = n.comments.map(Yr), o = n.projects.length + r.length + i.length + a.length;
|
|
6238
6258
|
return {
|
|
6239
|
-
textContent:
|
|
6259
|
+
textContent: Mu({
|
|
6240
6260
|
projectId: e,
|
|
6241
6261
|
source: t,
|
|
6242
6262
|
counts: {
|
|
@@ -6255,18 +6275,18 @@ function ku({ projectId: e, source: t, result: n }) {
|
|
|
6255
6275
|
}
|
|
6256
6276
|
};
|
|
6257
6277
|
}
|
|
6258
|
-
function
|
|
6278
|
+
function Mu({ projectId: e, source: t, counts: n, totalCount: r }) {
|
|
6259
6279
|
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
6280
|
}
|
|
6261
|
-
async function
|
|
6281
|
+
async function Nu(e, { projectId: t, templateId: n, locale: r }, { lookUp: i }) {
|
|
6262
6282
|
let [a, o] = await Promise.all([i("project", () => G(e, t), { fatal: (e) => e instanceof ot }), n ? i("template", () => e.getTemplate(Ta(n), r ? { locale: r } : void 0)) : void 0]);
|
|
6263
6283
|
return `Import ${n ? `the template "${o?.name ?? Ta(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
6284
|
}
|
|
6265
|
-
var
|
|
6285
|
+
var Pu = {
|
|
6266
6286
|
name: B.IMPORT_INTO_PROJECT,
|
|
6267
6287
|
description: "Import a template (by ID or URL) or CSV content into an existing project, like the app's \"Import from CSV\", adding its tasks, sections and comments to whatever is already there. To start a new project from a template, use add-projects with templateId instead. This writes immediately and cannot be undone, so only run it against a project the user named.",
|
|
6268
|
-
parameters:
|
|
6269
|
-
outputSchema:
|
|
6288
|
+
parameters: ku,
|
|
6289
|
+
outputSchema: Au,
|
|
6270
6290
|
annotations: {
|
|
6271
6291
|
readOnlyHint: !1,
|
|
6272
6292
|
destructiveHint: !1,
|
|
@@ -6276,7 +6296,7 @@ var Mu = {
|
|
|
6276
6296
|
if (!!t == !!n) throw Error("Provide exactly one source: either `templateId` or `csvFileContent`. Find template IDs with find-templates.");
|
|
6277
6297
|
let o = await a?.confirm({
|
|
6278
6298
|
key: "import",
|
|
6279
|
-
message: (n) =>
|
|
6299
|
+
message: (n) => Nu(i, {
|
|
6280
6300
|
projectId: e,
|
|
6281
6301
|
templateId: t,
|
|
6282
6302
|
locale: r
|
|
@@ -6293,7 +6313,7 @@ var Mu = {
|
|
|
6293
6313
|
}
|
|
6294
6314
|
};
|
|
6295
6315
|
let s = (t) => new lt(t, `The import into project (id=${e}) did not complete. If you created that project for this import, it may be empty.`);
|
|
6296
|
-
return
|
|
6316
|
+
return ju(t ? {
|
|
6297
6317
|
projectId: e,
|
|
6298
6318
|
source: "template",
|
|
6299
6319
|
result: await i.importTemplateFromId({
|
|
@@ -6315,7 +6335,7 @@ var Mu = {
|
|
|
6315
6335
|
})
|
|
6316
6336
|
});
|
|
6317
6337
|
}
|
|
6318
|
-
},
|
|
6338
|
+
}, Fu = {}, Iu = {
|
|
6319
6339
|
id: p.string().describe("The unique identifier for the workspace."),
|
|
6320
6340
|
name: p.string().describe("The name of the workspace."),
|
|
6321
6341
|
plan: p.enum(ne).describe("The workspace plan type."),
|
|
@@ -6324,12 +6344,12 @@ var Mu = {
|
|
|
6324
6344
|
isGuestAllowed: p.boolean().describe("Whether guests are allowed in the workspace."),
|
|
6325
6345
|
createdAt: p.string().optional().describe("The ISO 8601 timestamp when the workspace was created."),
|
|
6326
6346
|
creatorId: p.string().describe("The ID of the user who created the workspace.")
|
|
6327
|
-
},
|
|
6347
|
+
}, Lu = {
|
|
6328
6348
|
type: p.literal("workspaces").describe("The type of the response."),
|
|
6329
|
-
workspaces: p.array(p.object(
|
|
6349
|
+
workspaces: p.array(p.object(Iu)).describe("List of workspaces."),
|
|
6330
6350
|
count: p.number().describe("The total number of workspaces.")
|
|
6331
6351
|
};
|
|
6332
|
-
async function
|
|
6352
|
+
async function Ru(e) {
|
|
6333
6353
|
let t = (await e.getWorkspaces()).map((e) => ({
|
|
6334
6354
|
id: e.id,
|
|
6335
6355
|
name: e.name,
|
|
@@ -6354,34 +6374,34 @@ async function Iu(e) {
|
|
|
6354
6374
|
}
|
|
6355
6375
|
};
|
|
6356
6376
|
}
|
|
6357
|
-
var
|
|
6377
|
+
var zu = {
|
|
6358
6378
|
name: B.LIST_WORKSPACES,
|
|
6359
6379
|
description: "Get all workspaces for the authenticated user. Returns workspace details including ID, name, plan type (STARTER/BUSINESS), user role (ADMIN/MEMBER/GUEST), link sharing settings, guest permissions, creation date, and creator ID.",
|
|
6360
|
-
parameters:
|
|
6361
|
-
outputSchema:
|
|
6380
|
+
parameters: Fu,
|
|
6381
|
+
outputSchema: Lu,
|
|
6362
6382
|
annotations: {
|
|
6363
6383
|
readOnlyHint: !0,
|
|
6364
6384
|
destructiveHint: !1,
|
|
6365
6385
|
idempotentHint: !0
|
|
6366
6386
|
},
|
|
6367
6387
|
async execute(e, t) {
|
|
6368
|
-
let n = await
|
|
6388
|
+
let n = await Ru(t);
|
|
6369
6389
|
return {
|
|
6370
6390
|
textContent: n.textContent,
|
|
6371
6391
|
structuredContent: n.structuredContent
|
|
6372
6392
|
};
|
|
6373
6393
|
}
|
|
6374
|
-
}, { FIND_TASKS:
|
|
6394
|
+
}, { FIND_TASKS: Bu, FIND_PROJECT_COLLABORATORS: Vu, UPDATE_TASKS: Hu } = B, Uu = O.BULK_ACTIONS_PER_OPERATION, Wu = {
|
|
6375
6395
|
operation: p.enum([
|
|
6376
6396
|
"assign",
|
|
6377
6397
|
"unassign",
|
|
6378
6398
|
"reassign"
|
|
6379
6399
|
]).describe("The assignment operation to perform."),
|
|
6380
|
-
taskIds: p.array(p.string()).min(1).max(
|
|
6400
|
+
taskIds: p.array(p.string()).min(1).max(Uu).describe("The IDs of the tasks to operate on (max 50)."),
|
|
6381
6401
|
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
6402
|
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
6403
|
dryRun: p.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
|
|
6384
|
-
},
|
|
6404
|
+
}, Gu = {
|
|
6385
6405
|
results: p.array(p.object({
|
|
6386
6406
|
taskId: p.string().describe("The ID of the task."),
|
|
6387
6407
|
success: p.boolean().describe("Whether the operation was successful."),
|
|
@@ -6395,11 +6415,11 @@ var Lu = {
|
|
|
6395
6415
|
failed: p.number().describe("Number of failed operations."),
|
|
6396
6416
|
dryRun: p.boolean().describe("Whether this was a dry run.")
|
|
6397
6417
|
}).optional().describe("Summary of the operation.")
|
|
6398
|
-
},
|
|
6418
|
+
}, Ku = {
|
|
6399
6419
|
name: B.MANAGE_ASSIGNMENTS,
|
|
6400
|
-
description: `Assign, unassign or reassign up to ${
|
|
6401
|
-
parameters:
|
|
6402
|
-
outputSchema:
|
|
6420
|
+
description: `Assign, unassign or reassign up to ${Uu} 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.`,
|
|
6421
|
+
parameters: Wu,
|
|
6422
|
+
outputSchema: Gu,
|
|
6403
6423
|
annotations: {
|
|
6404
6424
|
readOnlyHint: !1,
|
|
6405
6425
|
destructiveHint: !0,
|
|
@@ -6449,7 +6469,7 @@ var Lu = {
|
|
|
6449
6469
|
newAssigneeId: void 0
|
|
6450
6470
|
}));
|
|
6451
6471
|
return {
|
|
6452
|
-
textContent:
|
|
6472
|
+
textContent: qu({
|
|
6453
6473
|
operation: n,
|
|
6454
6474
|
results: e,
|
|
6455
6475
|
dryRun: !0
|
|
@@ -6486,7 +6506,7 @@ var Lu = {
|
|
|
6486
6506
|
throw Error(`All ${a.length} unassign operation(s) failed: ${e}`);
|
|
6487
6507
|
}
|
|
6488
6508
|
return {
|
|
6489
|
-
textContent:
|
|
6509
|
+
textContent: qu({
|
|
6490
6510
|
operation: n,
|
|
6491
6511
|
results: a,
|
|
6492
6512
|
dryRun: !1
|
|
@@ -6561,7 +6581,7 @@ var Lu = {
|
|
|
6561
6581
|
throw Error(`All ${_.length} ${n} operation(s) failed: ${e}`);
|
|
6562
6582
|
}
|
|
6563
6583
|
return {
|
|
6564
|
-
textContent:
|
|
6584
|
+
textContent: qu({
|
|
6565
6585
|
operation: n,
|
|
6566
6586
|
results: _,
|
|
6567
6587
|
dryRun: o
|
|
@@ -6577,7 +6597,7 @@ var Lu = {
|
|
|
6577
6597
|
};
|
|
6578
6598
|
}
|
|
6579
6599
|
};
|
|
6580
|
-
function
|
|
6600
|
+
function qu({ operation: e, results: t, dryRun: n }) {
|
|
6581
6601
|
let r = t.filter((e) => e.success), i = t.filter((e) => !e.success), a = n ? "would be" : "were", o = {
|
|
6582
6602
|
assign: "assigned",
|
|
6583
6603
|
unassign: "unassigned",
|
|
@@ -6598,37 +6618,37 @@ function Gu({ operation: e, results: t, dryRun: n }) {
|
|
|
6598
6618
|
for (let t of e) s += ` • Task ${t.taskId}: ${t.error}\n`;
|
|
6599
6619
|
i.length > 5 && (s += ` • ... and ${i.length - 5} more failures\n`), s += "\n";
|
|
6600
6620
|
}
|
|
6601
|
-
return !n && r.length > 0 ? (s += "**Next steps:**\n", s += `• Use ${
|
|
6621
|
+
return !n && r.length > 0 ? (s += "**Next steps:**\n", s += `• Use ${Bu} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks\n`, s += `• Use ${Hu} for individual assignment changes\n`, i.length > 0 && (s += `• Check failed tasks and use ${Vu} 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 ${Vu} to find valid assignees\n`, s += "• Check task IDs and assignee permissions\n", s += "• Use dryRun=true to validate before executing\n"), s;
|
|
6602
6622
|
}
|
|
6603
6623
|
// src/tools/project-management.ts
|
|
6604
|
-
var { FIND_PROJECTS:
|
|
6624
|
+
var { FIND_PROJECTS: Ju } = B, Yu = {
|
|
6605
6625
|
action: p.enum([
|
|
6606
6626
|
"archive",
|
|
6607
6627
|
"unarchive",
|
|
6608
6628
|
"join"
|
|
6609
6629
|
]).describe("The action to perform on the project."),
|
|
6610
6630
|
projectId: p.string().min(1).describe("The ID of the project.")
|
|
6611
|
-
},
|
|
6631
|
+
}, Xu = {
|
|
6612
6632
|
project: mi.describe("The updated project."),
|
|
6613
6633
|
success: p.boolean().describe("Whether the action was successful.")
|
|
6614
|
-
},
|
|
6634
|
+
}, Zu = {
|
|
6615
6635
|
archive: "Archived",
|
|
6616
6636
|
unarchive: "Unarchived",
|
|
6617
6637
|
join: "Joined"
|
|
6618
|
-
},
|
|
6638
|
+
}, Qu = {
|
|
6619
6639
|
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:
|
|
6640
|
+
description: `Archive or unarchive a project by its ID, or join a workspace project the user hasn't joined (see ${Ju} includeUnjoined) when they ask to.`,
|
|
6641
|
+
parameters: Yu,
|
|
6642
|
+
outputSchema: Xu,
|
|
6623
6643
|
annotations: {
|
|
6624
6644
|
readOnlyHint: !1,
|
|
6625
6645
|
destructiveHint: !1,
|
|
6626
6646
|
idempotentHint: !0
|
|
6627
6647
|
},
|
|
6628
6648
|
async execute(e, t) {
|
|
6629
|
-
let n = Jr(await
|
|
6649
|
+
let n = Jr(await $u(e, t));
|
|
6630
6650
|
return {
|
|
6631
|
-
textContent: `${
|
|
6651
|
+
textContent: `${Zu[e.action]} project: ${n.name} (id=${n.id})`,
|
|
6632
6652
|
structuredContent: {
|
|
6633
6653
|
project: n,
|
|
6634
6654
|
success: !0
|
|
@@ -6636,7 +6656,7 @@ var { FIND_PROJECTS: Ku } = B, qu = {
|
|
|
6636
6656
|
};
|
|
6637
6657
|
}
|
|
6638
6658
|
};
|
|
6639
|
-
async function
|
|
6659
|
+
async function $u({ action: e, projectId: t }, n) {
|
|
6640
6660
|
switch (e) {
|
|
6641
6661
|
case "archive": return n.archiveProject(t);
|
|
6642
6662
|
case "unarchive": {
|
|
@@ -6650,7 +6670,7 @@ async function Zu({ action: e, projectId: t }, n) {
|
|
|
6650
6670
|
}
|
|
6651
6671
|
}
|
|
6652
6672
|
// src/tools/project-move.ts
|
|
6653
|
-
var
|
|
6673
|
+
var ed = {
|
|
6654
6674
|
action: p.enum(["move-to-workspace", "move-to-personal"]).describe("The action to perform on the project."),
|
|
6655
6675
|
projectId: p.string().min(1).describe("The ID of the project to move."),
|
|
6656
6676
|
workspaceId: p.string().min(1).optional().describe("The target workspace ID. Required when action is move-to-workspace."),
|
|
@@ -6660,14 +6680,14 @@ var Qu = {
|
|
|
6660
6680
|
"team",
|
|
6661
6681
|
"public"
|
|
6662
6682
|
]).optional().describe("Optional access visibility for the project in the workspace (restricted, team, or public).")
|
|
6663
|
-
},
|
|
6683
|
+
}, td = {
|
|
6664
6684
|
project: mi.describe("The moved project."),
|
|
6665
6685
|
success: p.boolean().describe("Whether the move was successful.")
|
|
6666
|
-
},
|
|
6686
|
+
}, nd = {
|
|
6667
6687
|
name: B.PROJECT_MOVE,
|
|
6668
6688
|
description: "Move a project between personal and workspace contexts.",
|
|
6669
|
-
parameters:
|
|
6670
|
-
outputSchema:
|
|
6689
|
+
parameters: ed,
|
|
6690
|
+
outputSchema: td,
|
|
6671
6691
|
annotations: {
|
|
6672
6692
|
readOnlyHint: !1,
|
|
6673
6693
|
destructiveHint: !0,
|
|
@@ -6697,10 +6717,10 @@ var Qu = {
|
|
|
6697
6717
|
}
|
|
6698
6718
|
};
|
|
6699
6719
|
// src/utils/order-keys.ts
|
|
6700
|
-
function
|
|
6720
|
+
function rd(e, t) {
|
|
6701
6721
|
let n = new Map(e.map((e) => [e.id, e])), r = new Set(t.map((e) => e.id));
|
|
6702
6722
|
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 ?
|
|
6723
|
+
let i = e.every((e) => e.key !== null), a = [...e].sort(i ? cd : ld).filter((e) => !r.has(e.id)), o = [...t].sort((e, t) => e.position - t.position), s;
|
|
6704
6724
|
for (let { id: e, position: t } of o) {
|
|
6705
6725
|
let r = n.get(e);
|
|
6706
6726
|
if (!r) continue;
|
|
@@ -6710,20 +6730,20 @@ function td(e, t) {
|
|
|
6710
6730
|
index: o
|
|
6711
6731
|
};
|
|
6712
6732
|
}
|
|
6713
|
-
if (!i || !
|
|
6733
|
+
if (!i || !od(a, r)) return sd(a);
|
|
6714
6734
|
let c = /* @__PURE__ */ new Map(), l = [], u = null;
|
|
6715
|
-
for (let e of a) r.has(e.id) ? l.push(e) : (
|
|
6716
|
-
return
|
|
6735
|
+
for (let e of a) r.has(e.id) ? l.push(e) : (id(l, u, e.key, c), l = [], u = e.key);
|
|
6736
|
+
return id(l, u, null, c), c;
|
|
6717
6737
|
}
|
|
6718
|
-
function
|
|
6719
|
-
if (e.length === 0 ||
|
|
6738
|
+
function id(e, t, n, r) {
|
|
6739
|
+
if (e.length === 0 || ad(e, t, n)) return;
|
|
6720
6740
|
let i = ge(t, n, e.length);
|
|
6721
6741
|
e.forEach((e, t) => {
|
|
6722
6742
|
let n = i[t];
|
|
6723
6743
|
n !== void 0 && n !== e.key && r.set(e.id, n);
|
|
6724
6744
|
});
|
|
6725
6745
|
}
|
|
6726
|
-
function
|
|
6746
|
+
function ad(e, t, n) {
|
|
6727
6747
|
let r = t;
|
|
6728
6748
|
for (let { key: t } of e) {
|
|
6729
6749
|
if (t === null || r !== null && t <= r) return !1;
|
|
@@ -6731,7 +6751,7 @@ function rd(e, t, n) {
|
|
|
6731
6751
|
}
|
|
6732
6752
|
return n === null || r !== null && r < n;
|
|
6733
6753
|
}
|
|
6734
|
-
function
|
|
6754
|
+
function od(e, t) {
|
|
6735
6755
|
let n = null;
|
|
6736
6756
|
for (let { id: r, key: i } of e) if (!t.has(r)) {
|
|
6737
6757
|
if (i === null || n !== null && i <= n) return !1;
|
|
@@ -6739,40 +6759,40 @@ function id(e, t) {
|
|
|
6739
6759
|
}
|
|
6740
6760
|
return !0;
|
|
6741
6761
|
}
|
|
6742
|
-
function
|
|
6762
|
+
function sd(e) {
|
|
6743
6763
|
let t = ge(null, null, e.length), n = /* @__PURE__ */ new Map();
|
|
6744
6764
|
return e.forEach((e, r) => {
|
|
6745
6765
|
let i = t[r];
|
|
6746
6766
|
i !== void 0 && i !== e.key && n.set(e.id, i);
|
|
6747
6767
|
}), n;
|
|
6748
6768
|
}
|
|
6749
|
-
function
|
|
6769
|
+
function cd(e, t) {
|
|
6750
6770
|
let n = e.key ?? "", r = t.key ?? "";
|
|
6751
6771
|
return n < r ? -1 : +(n > r);
|
|
6752
6772
|
}
|
|
6753
|
-
function
|
|
6773
|
+
function ld(e, t) {
|
|
6754
6774
|
return e.legacyOrder - t.legacyOrder;
|
|
6755
6775
|
}
|
|
6756
6776
|
// src/tools/reorder-objects.ts
|
|
6757
|
-
var
|
|
6777
|
+
var ud = ["project", "section"], dd = p.object({
|
|
6758
6778
|
id: p.string().min(1).describe("The ID of the entity."),
|
|
6759
6779
|
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
6780
|
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(
|
|
6781
|
+
}), fd = {
|
|
6782
|
+
type: p.enum(ud).describe("\"project\": personal projects among the siblings under their parent, or workspace projects within their folder. \"section\": sections within their project."),
|
|
6783
|
+
items: p.array(dd).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.")
|
|
6784
|
+
}, pd = {
|
|
6785
|
+
type: p.enum(ud).describe("The type of entity that was reordered/moved."),
|
|
6766
6786
|
movedCount: p.number().describe("The number of entities moved to a new parent."),
|
|
6767
6787
|
reorderedCount: p.number().describe("The number of entities reordered."),
|
|
6768
6788
|
affectedIds: p.array(p.string()).describe("The IDs of the entities moved or reordered."),
|
|
6769
6789
|
failures: p.array(Y).describe("Entities that could not be moved or reordered, with the reason for each."),
|
|
6770
6790
|
success: p.boolean().describe("Whether every entity was moved and reordered as asked.")
|
|
6771
|
-
},
|
|
6791
|
+
}, md = {
|
|
6772
6792
|
name: B.REORDER_OBJECTS,
|
|
6773
6793
|
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:
|
|
6794
|
+
parameters: fd,
|
|
6795
|
+
outputSchema: pd,
|
|
6776
6796
|
annotations: {
|
|
6777
6797
|
readOnlyHint: !1,
|
|
6778
6798
|
destructiveHint: !1,
|
|
@@ -6785,7 +6805,7 @@ var cd = ["project", "section"], ld = p.object({
|
|
|
6785
6805
|
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
6806
|
if (e.parentId !== void 0 && n !== "project") throw Error(`parentId is only supported when type is "project", but type is "${n}".`);
|
|
6787
6807
|
}
|
|
6788
|
-
let a = n === "project" ? await
|
|
6808
|
+
let a = n === "project" ? await hd(t, r) : await gd(t, r);
|
|
6789
6809
|
L(B.REORDER_OBJECTS, r.length, a.failures);
|
|
6790
6810
|
let o = n === "project" ? "projects" : "sections", s = r.map((e) => e.id).filter((e) => a.movedIds.has(e) || a.reorderedIds.has(e)), c = [];
|
|
6791
6811
|
return a.movedIds.size > 0 && c.push(`moved ${a.movedIds.size}`), (a.reorderedIds.size > 0 || c.length === 0) && c.push(`reordered ${a.reorderedIds.size}`), {
|
|
@@ -6801,10 +6821,10 @@ var cd = ["project", "section"], ld = p.object({
|
|
|
6801
6821
|
};
|
|
6802
6822
|
}
|
|
6803
6823
|
};
|
|
6804
|
-
async function
|
|
6805
|
-
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [], a = await
|
|
6824
|
+
async function hd(e, t) {
|
|
6825
|
+
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [], a = await Cd(e), o = [];
|
|
6806
6826
|
for (let e of t) {
|
|
6807
|
-
let t = a.get(e.id), n = t ?
|
|
6827
|
+
let t = a.get(e.id), n = t ? yd(t, e) : "Project not found, or you do not have access to it.";
|
|
6808
6828
|
n ? i.push({
|
|
6809
6829
|
item: e.id,
|
|
6810
6830
|
error: n
|
|
@@ -6832,7 +6852,7 @@ async function pd(e, t) {
|
|
|
6832
6852
|
failures: i
|
|
6833
6853
|
};
|
|
6834
6854
|
if (n.size > 0) try {
|
|
6835
|
-
a = await
|
|
6855
|
+
a = await Cd(e);
|
|
6836
6856
|
} catch (e) {
|
|
6837
6857
|
let t = P(e);
|
|
6838
6858
|
for (let r of l) i.push({
|
|
@@ -6846,7 +6866,7 @@ async function pd(e, t) {
|
|
|
6846
6866
|
failures: i
|
|
6847
6867
|
};
|
|
6848
6868
|
}
|
|
6849
|
-
let u =
|
|
6869
|
+
let u = _d([...a.values()].filter(bd), xd), d = /* @__PURE__ */ new Map(), f = [];
|
|
6850
6870
|
for (let e of l) {
|
|
6851
6871
|
let t = a.get(e.id);
|
|
6852
6872
|
if (!t) {
|
|
@@ -6857,7 +6877,7 @@ async function pd(e, t) {
|
|
|
6857
6877
|
continue;
|
|
6858
6878
|
}
|
|
6859
6879
|
f.push(e);
|
|
6860
|
-
let n =
|
|
6880
|
+
let n = xd(t), r = d.get(n) ?? [];
|
|
6861
6881
|
r.push({
|
|
6862
6882
|
id: e.id,
|
|
6863
6883
|
position: e.order
|
|
@@ -6865,7 +6885,7 @@ async function pd(e, t) {
|
|
|
6865
6885
|
}
|
|
6866
6886
|
let p = [];
|
|
6867
6887
|
for (let [e, t] of d) {
|
|
6868
|
-
let n =
|
|
6888
|
+
let n = rd((u.get(e) ?? []).map(Sd), t);
|
|
6869
6889
|
for (let [e, t] of n) {
|
|
6870
6890
|
let n = a.get(e);
|
|
6871
6891
|
p.push({
|
|
@@ -6880,14 +6900,14 @@ async function pd(e, t) {
|
|
|
6880
6900
|
});
|
|
6881
6901
|
}
|
|
6882
6902
|
}
|
|
6883
|
-
return await
|
|
6903
|
+
return await vd(e, p, f, r, i), {
|
|
6884
6904
|
movedIds: n,
|
|
6885
6905
|
reorderedIds: r,
|
|
6886
6906
|
failures: i
|
|
6887
6907
|
};
|
|
6888
6908
|
}
|
|
6889
|
-
async function
|
|
6890
|
-
let n = /* @__PURE__ */ new Set(), r = [], i = await
|
|
6909
|
+
async function gd(e, t) {
|
|
6910
|
+
let n = /* @__PURE__ */ new Set(), r = [], i = await wd(e), a = _d([...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
6911
|
for (let e of o) {
|
|
6892
6912
|
let t = i.get(e.id);
|
|
6893
6913
|
if (!t || t.isDeleted) {
|
|
@@ -6913,7 +6933,7 @@ async function md(e, t) {
|
|
|
6913
6933
|
}
|
|
6914
6934
|
let l = [];
|
|
6915
6935
|
for (let [e, t] of s) {
|
|
6916
|
-
let n =
|
|
6936
|
+
let n = rd((a.get(e) ?? []).map((e) => ({
|
|
6917
6937
|
id: e.id,
|
|
6918
6938
|
key: e.orderKey ?? null,
|
|
6919
6939
|
legacyOrder: e.sectionOrder
|
|
@@ -6926,13 +6946,13 @@ async function md(e, t) {
|
|
|
6926
6946
|
})
|
|
6927
6947
|
});
|
|
6928
6948
|
}
|
|
6929
|
-
return await
|
|
6949
|
+
return await vd(e, l, c, n, r), {
|
|
6930
6950
|
movedIds: /* @__PURE__ */ new Set(),
|
|
6931
6951
|
reorderedIds: n,
|
|
6932
6952
|
failures: r
|
|
6933
6953
|
};
|
|
6934
6954
|
}
|
|
6935
|
-
function
|
|
6955
|
+
function _d(e, t) {
|
|
6936
6956
|
let n = /* @__PURE__ */ new Map();
|
|
6937
6957
|
for (let r of e) {
|
|
6938
6958
|
let e = t(r), i = n.get(e) ?? [];
|
|
@@ -6940,7 +6960,7 @@ function hd(e, t) {
|
|
|
6940
6960
|
}
|
|
6941
6961
|
return n;
|
|
6942
6962
|
}
|
|
6943
|
-
async function
|
|
6963
|
+
async function vd(e, t, n, r, i) {
|
|
6944
6964
|
let a = /* @__PURE__ */ new Set();
|
|
6945
6965
|
if (t.length > 0) {
|
|
6946
6966
|
let { outcomes: n } = await $(e, t.map((e) => e.command));
|
|
@@ -6955,19 +6975,19 @@ async function gd(e, t, n, r, i) {
|
|
|
6955
6975
|
}
|
|
6956
6976
|
for (let { id: e } of n) a.has(e) || r.add(e);
|
|
6957
6977
|
}
|
|
6958
|
-
function
|
|
6978
|
+
function yd(e, t) {
|
|
6959
6979
|
if (e.isDeleted) return "Project not found, or you do not have access to it.";
|
|
6960
6980
|
if (e.isArchived) return "Archived projects cannot be reordered or moved.";
|
|
6961
6981
|
if (!E(e) && e.inboxProject) return "The Inbox always comes first and cannot be reordered or moved.";
|
|
6962
6982
|
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
6983
|
}
|
|
6964
|
-
function
|
|
6984
|
+
function bd(e) {
|
|
6965
6985
|
return e.isDeleted || e.isArchived ? !1 : E(e) || !e.inboxProject;
|
|
6966
6986
|
}
|
|
6967
|
-
function
|
|
6987
|
+
function xd(e) {
|
|
6968
6988
|
return E(e) ? `workspace:${e.workspaceId}:${e.folderId ?? "root"}` : `personal:${e.parentId ?? "root"}`;
|
|
6969
6989
|
}
|
|
6970
|
-
function
|
|
6990
|
+
function Sd(e) {
|
|
6971
6991
|
return E(e) ? {
|
|
6972
6992
|
id: e.id,
|
|
6973
6993
|
key: e.defaultOrderKey ?? null,
|
|
@@ -6978,14 +6998,14 @@ function bd(e) {
|
|
|
6978
6998
|
legacyOrder: e.childOrder
|
|
6979
6999
|
};
|
|
6980
7000
|
}
|
|
6981
|
-
async function
|
|
7001
|
+
async function Cd(e) {
|
|
6982
7002
|
let t = await R(() => e.sync({
|
|
6983
7003
|
resourceTypes: ["projects"],
|
|
6984
7004
|
syncToken: "*"
|
|
6985
7005
|
}));
|
|
6986
7006
|
return new Map((t.projects ?? []).map((e) => [e.id, e]));
|
|
6987
7007
|
}
|
|
6988
|
-
async function
|
|
7008
|
+
async function wd(e) {
|
|
6989
7009
|
let t = await R(() => e.sync({
|
|
6990
7010
|
resourceTypes: ["sections"],
|
|
6991
7011
|
syncToken: "*"
|
|
@@ -6993,20 +7013,20 @@ async function Sd(e) {
|
|
|
6993
7013
|
return new Map((t.sections ?? []).map((e) => [e.id, e]));
|
|
6994
7014
|
}
|
|
6995
7015
|
// src/tools/reschedule-tasks.ts
|
|
6996
|
-
var
|
|
7016
|
+
var Td = p.object({
|
|
6997
7017
|
id: p.string().min(1).describe("The ID of the task to reschedule."),
|
|
6998
7018
|
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
7019
|
duration: p.string().optional().describe("Optional new duration, e.g. for time-blocking: \"15m\", \"1h\", \"2h30m\".")
|
|
7000
|
-
}),
|
|
7020
|
+
}), Ed = { tasks: p.array(Td).min(1).max(O.BULK_ACTIONS_PER_OPERATION).describe("The tasks to reschedule with their new dates.") }, Dd = {
|
|
7001
7021
|
tasks: p.array(J).describe("The rescheduled tasks."),
|
|
7002
7022
|
totalCount: p.number().describe("The total number of tasks rescheduled."),
|
|
7003
7023
|
rescheduledTaskIds: p.array(p.string()).describe("The IDs of the rescheduled tasks."),
|
|
7004
7024
|
failures: p.array(Y).describe("Tasks that could not be rescheduled, with reasons.")
|
|
7005
|
-
},
|
|
7025
|
+
}, Od = {
|
|
7006
7026
|
name: B.RESCHEDULE_TASKS,
|
|
7007
7027
|
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:
|
|
7028
|
+
parameters: Ed,
|
|
7029
|
+
outputSchema: Dd,
|
|
7010
7030
|
annotations: {
|
|
7011
7031
|
readOnlyHint: !1,
|
|
7012
7032
|
destructiveHint: !0,
|
|
@@ -7017,7 +7037,7 @@ var Cd = p.object({
|
|
|
7017
7037
|
i.push(...a.failures);
|
|
7018
7038
|
let o = [];
|
|
7019
7039
|
for (let { item: e, index: t, value: n } of a.succeeded) {
|
|
7020
|
-
let i =
|
|
7040
|
+
let i = kd(e.date, n);
|
|
7021
7041
|
i && o.push({
|
|
7022
7042
|
id: e.id,
|
|
7023
7043
|
command: T("item_update", {
|
|
@@ -7054,9 +7074,9 @@ var Cd = p.object({
|
|
|
7054
7074
|
};
|
|
7055
7075
|
}
|
|
7056
7076
|
};
|
|
7057
|
-
function
|
|
7077
|
+
function kd(e, t) {
|
|
7058
7078
|
if (t.due) return { due: {
|
|
7059
|
-
date:
|
|
7079
|
+
date: Ad(e, t.due),
|
|
7060
7080
|
...t.due.isRecurring && { string: t.due.string },
|
|
7061
7081
|
isRecurring: t.due.isRecurring,
|
|
7062
7082
|
timezone: t.due.timezone ?? void 0,
|
|
@@ -7064,28 +7084,28 @@ function Dd(e, t) {
|
|
|
7064
7084
|
} };
|
|
7065
7085
|
if (t.deadline) return { deadline: { date: e.slice(0, 10) } };
|
|
7066
7086
|
}
|
|
7067
|
-
function
|
|
7087
|
+
function Ad(e, t) {
|
|
7068
7088
|
let n = /^\d{4}-\d{2}-\d{2}$/.test(e), r = t.date.substring(10);
|
|
7069
7089
|
if (n && r) {
|
|
7070
7090
|
if (r.endsWith("Z") && t.timezone) {
|
|
7071
|
-
let n =
|
|
7091
|
+
let n = jd(e, t.date, t.timezone);
|
|
7072
7092
|
if (n) return n;
|
|
7073
7093
|
}
|
|
7074
7094
|
return e + r;
|
|
7075
7095
|
}
|
|
7076
7096
|
return e;
|
|
7077
7097
|
}
|
|
7078
|
-
function
|
|
7079
|
-
let r = Date.parse(t), i =
|
|
7098
|
+
function jd(e, t, n) {
|
|
7099
|
+
let r = Date.parse(t), i = Nd(n, r);
|
|
7080
7100
|
if (i === void 0) return;
|
|
7081
7101
|
let a = new Date(r + i * 6e4).toISOString().slice(11, 19), o = Date.parse(`${e}T${a}Z`);
|
|
7082
7102
|
if (Number.isNaN(o) || new Date(o).toISOString().slice(0, 10) !== e) return;
|
|
7083
|
-
let s =
|
|
7103
|
+
let s = Nd(n, o - i * 6e4) ?? i;
|
|
7084
7104
|
return `${(/* @__PURE__ */ new Date(o - s * 6e4)).toISOString().slice(0, 19)}Z`;
|
|
7085
7105
|
}
|
|
7086
|
-
var
|
|
7087
|
-
function
|
|
7088
|
-
let n =
|
|
7106
|
+
var Md = /^GMT ([+-])(\d{1,2}):(\d{2})$/;
|
|
7107
|
+
function Nd(e, t) {
|
|
7108
|
+
let n = Md.exec(e);
|
|
7089
7109
|
if (n) {
|
|
7090
7110
|
let [, e, t, r] = n;
|
|
7091
7111
|
return An(`${e}${t?.padStart(2, "0")}:${r}`);
|
|
@@ -7093,18 +7113,18 @@ function jd(e, t) {
|
|
|
7093
7113
|
return In(t, e);
|
|
7094
7114
|
}
|
|
7095
7115
|
// src/tools/search.ts
|
|
7096
|
-
var
|
|
7116
|
+
var Pd = { query: p.string().min(1).describe("The search query string to find tasks and projects.") }, Fd = {
|
|
7097
7117
|
results: p.array(p.object({
|
|
7098
7118
|
id: p.string().describe("The ID of the result."),
|
|
7099
7119
|
title: p.string().describe("The title of the result."),
|
|
7100
7120
|
url: p.string().describe("The URL of the result.")
|
|
7101
7121
|
})).describe("The search results."),
|
|
7102
7122
|
totalCount: p.number().describe("Total number of results found.")
|
|
7103
|
-
},
|
|
7123
|
+
}, Id = {
|
|
7104
7124
|
name: B.SEARCH,
|
|
7105
7125
|
description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
|
|
7106
|
-
parameters:
|
|
7107
|
-
outputSchema:
|
|
7126
|
+
parameters: Pd,
|
|
7127
|
+
outputSchema: Fd,
|
|
7108
7128
|
annotations: {
|
|
7109
7129
|
readOnlyHint: !0,
|
|
7110
7130
|
destructiveHint: !1,
|
|
@@ -7135,20 +7155,20 @@ var Md = { query: p.string().min(1).describe("The search query string to find ta
|
|
|
7135
7155
|
}
|
|
7136
7156
|
};
|
|
7137
7157
|
}
|
|
7138
|
-
},
|
|
7158
|
+
}, Ld = {
|
|
7139
7159
|
message: p.string().trim().min(1).max(80).optional().describe("Omit for an emoji-only status."),
|
|
7140
7160
|
emoji: p.string().trim().min(1).optional().describe("A Unicode emoji, such as 🏝️."),
|
|
7141
7161
|
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
7162
|
pauseNotifications: p.boolean().optional().describe("Hold back Comms notifications while active. They are not sent later."),
|
|
7143
7163
|
pauseActivity: p.boolean().optional().describe("Pause Karma and streaks while active."),
|
|
7144
7164
|
clear: p.boolean().optional().describe("Remove the status. Use alone.")
|
|
7145
|
-
},
|
|
7146
|
-
function
|
|
7165
|
+
}, Rd = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|([+-])(\d{2}):(\d{2}))$/i, zd = -720, Bd = 840;
|
|
7166
|
+
function Vd(e) {
|
|
7147
7167
|
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
7168
|
}
|
|
7149
|
-
function
|
|
7150
|
-
let n =
|
|
7151
|
-
if (!n) throw
|
|
7169
|
+
function Hd(e, t) {
|
|
7170
|
+
let n = Rd.exec(e);
|
|
7171
|
+
if (!n) throw Vd(e);
|
|
7152
7172
|
let [, r, i, a, o, s, c = "0", l = ""] = n, [u, d, f, p, m, h] = [
|
|
7153
7173
|
r,
|
|
7154
7174
|
i,
|
|
@@ -7159,14 +7179,14 @@ function Bd(e, t) {
|
|
|
7159
7179
|
].map(Number), g = /* @__PURE__ */ new Date(0);
|
|
7160
7180
|
g.setUTCFullYear(u, d - 1, f), g.setUTCHours(p, m, h);
|
|
7161
7181
|
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 <
|
|
7182
|
+
if (!_ || v < zd || v > Bd) throw Vd(e);
|
|
7163
7183
|
let y = new Date(e);
|
|
7164
|
-
if (Number.isNaN(y.getTime())) throw
|
|
7184
|
+
if (Number.isNaN(y.getTime())) throw Vd(e);
|
|
7165
7185
|
if (y.getTime() <= t.getTime()) throw Error(`activeUntil must be in the future. Got "${e}".`);
|
|
7166
7186
|
return y.toISOString();
|
|
7167
7187
|
}
|
|
7168
|
-
var
|
|
7169
|
-
function
|
|
7188
|
+
var Ud = { scope: { mode: "all" } };
|
|
7189
|
+
function Wd(e, t) {
|
|
7170
7190
|
let { clear: n, message: r, emoji: i, activeUntil: a, pauseNotifications: o, pauseActivity: s } = e;
|
|
7171
7191
|
if (n) {
|
|
7172
7192
|
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,25 +7196,25 @@ function Hd(e, t) {
|
|
|
7176
7196
|
return {
|
|
7177
7197
|
message: r ?? null,
|
|
7178
7198
|
emoji: i ?? null,
|
|
7179
|
-
activeUntil: a === void 0 ? null :
|
|
7199
|
+
activeUntil: a === void 0 ? null : Hd(a, t),
|
|
7180
7200
|
effects: o || s ? {
|
|
7181
|
-
pauseNotifications: o ?
|
|
7182
|
-
pauseActivity: s ?
|
|
7201
|
+
pauseNotifications: o ? Ud : null,
|
|
7202
|
+
pauseActivity: s ? Ud : null
|
|
7183
7203
|
} : null
|
|
7184
7204
|
};
|
|
7185
7205
|
}
|
|
7186
|
-
function
|
|
7206
|
+
function Gd(e) {
|
|
7187
7207
|
return e ? e.replace(/\uFE0F/g, "") : null;
|
|
7188
7208
|
}
|
|
7189
|
-
function
|
|
7209
|
+
function Kd(e, t) {
|
|
7190
7210
|
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) &&
|
|
7211
|
+
return (e.message ?? null) === (t.message ?? null) && Gd(e.emoji) === Gd(t.emoji) && n === r && !!e.effects?.pauseNotifications == !!t.effects?.pauseNotifications && !!e.effects?.pauseActivity == !!t.effects?.pauseActivity;
|
|
7192
7212
|
}
|
|
7193
|
-
var
|
|
7213
|
+
var qd = {
|
|
7194
7214
|
name: B.SET_USER_STATUS,
|
|
7195
7215
|
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:
|
|
7197
|
-
outputSchema:
|
|
7216
|
+
parameters: Ld,
|
|
7217
|
+
outputSchema: yu,
|
|
7198
7218
|
annotations: {
|
|
7199
7219
|
readOnlyHint: !1,
|
|
7200
7220
|
destructiveHint: !0,
|
|
@@ -7202,39 +7222,39 @@ var Gd = {
|
|
|
7202
7222
|
openWorldHint: !0
|
|
7203
7223
|
},
|
|
7204
7224
|
async execute(e, t) {
|
|
7205
|
-
let n =
|
|
7225
|
+
let n = Wd(e, /* @__PURE__ */ new Date()), { outcomes: [r] } = await $(t, [T("user_update", { status: n })]);
|
|
7206
7226
|
if (r?.status !== "fulfilled") throw r?.reason ?? /* @__PURE__ */ Error("Todoist did not report whether the status was applied.");
|
|
7207
|
-
let i = await
|
|
7227
|
+
let i = await xu(t).catch(() => {
|
|
7208
7228
|
throw Error(`The status was written, but reading it back failed, so it is unconfirmed. Use ${B.GET_USER_STATUS} to check it.`);
|
|
7209
7229
|
});
|
|
7210
7230
|
if (n === null) {
|
|
7211
7231
|
if (i) throw Error(`Todoist accepted the clear but still reports a status. Another app may have set it at the same moment; use ${B.GET_USER_STATUS} to see it.`);
|
|
7212
|
-
return
|
|
7232
|
+
return Cu(null, "Status cleared");
|
|
7213
7233
|
}
|
|
7214
7234
|
if (!i) throw Error("Todoist accepted the status but reports no active status, so it may have expired already.");
|
|
7215
|
-
if (!
|
|
7216
|
-
return
|
|
7235
|
+
if (!Kd(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.`);
|
|
7236
|
+
return Cu(i, "Status set");
|
|
7217
7237
|
}
|
|
7218
|
-
},
|
|
7238
|
+
}, Jd = { ids: p.array(p.string().min(1)).min(1).max(O.BULK_ACTIONS_PER_OPERATION).describe("The IDs of the tasks to uncomplete.") }, Yd = {
|
|
7219
7239
|
uncompleted: p.array(p.string()).describe("The IDs of successfully uncompleted tasks."),
|
|
7220
7240
|
failures: p.array(Y).describe("Failed task uncompletion with error details."),
|
|
7221
7241
|
totalRequested: p.number().describe("The total number of tasks requested to uncomplete."),
|
|
7222
7242
|
successCount: p.number().describe("The number of successfully uncompleted tasks."),
|
|
7223
7243
|
failureCount: p.number().describe("The number of failed task uncompletions.")
|
|
7224
|
-
},
|
|
7244
|
+
}, Xd = {
|
|
7225
7245
|
name: B.UNCOMPLETE_TASKS,
|
|
7226
7246
|
description: "Uncomplete (reopen) one or more completed tasks by their IDs.",
|
|
7227
|
-
parameters:
|
|
7228
|
-
outputSchema:
|
|
7247
|
+
parameters: Jd,
|
|
7248
|
+
outputSchema: Yd,
|
|
7229
7249
|
annotations: {
|
|
7230
7250
|
readOnlyHint: !1,
|
|
7231
7251
|
destructiveHint: !1,
|
|
7232
7252
|
idempotentHint: !1
|
|
7233
7253
|
},
|
|
7234
7254
|
async execute(e, t) {
|
|
7235
|
-
let n = await
|
|
7255
|
+
let n = await Zd(t, e.ids), { succeeded: r, failures: i } = I(e.ids, n, (e) => e), a = r.map(({ item: e }) => e);
|
|
7236
7256
|
return L(B.UNCOMPLETE_TASKS, e.ids.length, i), {
|
|
7237
|
-
textContent:
|
|
7257
|
+
textContent: Qd({
|
|
7238
7258
|
uncompleted: a,
|
|
7239
7259
|
failures: i,
|
|
7240
7260
|
args: e
|
|
@@ -7249,14 +7269,14 @@ var Gd = {
|
|
|
7249
7269
|
};
|
|
7250
7270
|
}
|
|
7251
7271
|
};
|
|
7252
|
-
async function
|
|
7272
|
+
async function Zd(e, t) {
|
|
7253
7273
|
let n = [...new Set(t)], { outcomes: r } = await $(e, n.map((e) => T("item_uncomplete", { id: e })), { limit: Lt(e) }), i = new Map(n.map((e, t) => [e, r[t]]));
|
|
7254
7274
|
return t.map((e) => i.get(e) ?? {
|
|
7255
7275
|
status: "rejected",
|
|
7256
7276
|
reason: /* @__PURE__ */ Error("Todoist did not report whether this task was reopened")
|
|
7257
7277
|
});
|
|
7258
7278
|
}
|
|
7259
|
-
function
|
|
7279
|
+
function Qd({ uncompleted: e, failures: t, args: n }) {
|
|
7260
7280
|
return Pi({
|
|
7261
7281
|
action: "Uncompleted tasks",
|
|
7262
7282
|
success: e.length,
|
|
@@ -7267,10 +7287,10 @@ function Xd({ uncompleted: e, failures: t, args: n }) {
|
|
|
7267
7287
|
});
|
|
7268
7288
|
}
|
|
7269
7289
|
// src/tools/update-comments.ts
|
|
7270
|
-
var
|
|
7290
|
+
var $d = p.object({
|
|
7271
7291
|
id: p.string().min(1).describe("The ID of the comment to update."),
|
|
7272
7292
|
content: p.string().min(1).describe("The new content for the comment.")
|
|
7273
|
-
}),
|
|
7293
|
+
}), ef = { comments: p.array($d).min(1).max(O.ITEMS_PER_OPERATION).describe("The comments to update.") }, tf = {
|
|
7274
7294
|
comments: p.array(bi).describe("The updated comments."),
|
|
7275
7295
|
totalCount: p.number().describe("The total number of comments updated."),
|
|
7276
7296
|
updatedCommentIds: p.array(p.string()).describe("The IDs of the updated comments."),
|
|
@@ -7279,11 +7299,11 @@ var Zd = p.object({
|
|
|
7279
7299
|
updateCount: p.number().describe("The number of comments updated."),
|
|
7280
7300
|
failureCount: p.number()
|
|
7281
7301
|
}).describe("Summary of operations performed.")
|
|
7282
|
-
},
|
|
7302
|
+
}, nf = {
|
|
7283
7303
|
name: B.UPDATE_COMMENTS,
|
|
7284
7304
|
description: "Update multiple existing comments with new content.",
|
|
7285
|
-
parameters:
|
|
7286
|
-
outputSchema:
|
|
7305
|
+
parameters: ef,
|
|
7306
|
+
outputSchema: tf,
|
|
7287
7307
|
annotations: {
|
|
7288
7308
|
readOnlyHint: !1,
|
|
7289
7309
|
destructiveHint: !0,
|
|
@@ -7292,7 +7312,7 @@ var Zd = p.object({
|
|
|
7292
7312
|
async execute(e, t) {
|
|
7293
7313
|
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 }) => Yr(e));
|
|
7294
7314
|
return L(B.UPDATE_COMMENTS, n.length, i), {
|
|
7295
|
-
textContent: X(
|
|
7315
|
+
textContent: X(rf({ comments: a }), i),
|
|
7296
7316
|
structuredContent: {
|
|
7297
7317
|
comments: a,
|
|
7298
7318
|
totalCount: a.length,
|
|
@@ -7306,7 +7326,7 @@ var Zd = p.object({
|
|
|
7306
7326
|
};
|
|
7307
7327
|
}
|
|
7308
7328
|
};
|
|
7309
|
-
function
|
|
7329
|
+
function rf({ comments: e }) {
|
|
7310
7330
|
let t = e.filter((e) => e.taskId).length, n = e.filter((e) => e.projectId).length, r = [];
|
|
7311
7331
|
if (t > 0) {
|
|
7312
7332
|
let e = t > 1 ? "comments" : "comment";
|
|
@@ -7319,14 +7339,14 @@ function tf({ comments: e }) {
|
|
|
7319
7339
|
return r.length > 0 ? `Updated ${r.join(" and ")}` : "No comments updated";
|
|
7320
7340
|
}
|
|
7321
7341
|
// src/tools/update-filters.ts
|
|
7322
|
-
var
|
|
7342
|
+
var af = p.object({
|
|
7323
7343
|
id: p.string().min(1).describe("The ID of the filter to update."),
|
|
7324
7344
|
name: p.string().min(1).optional().describe("The new name of the filter."),
|
|
7325
7345
|
query: p.string().min(1).optional().describe("The new filter query string. Examples: \"today & p1\", \"#Work & overdue\", \"@email & today\"."),
|
|
7326
7346
|
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
7347
|
color: fi,
|
|
7328
7348
|
isFavorite: p.boolean().optional().describe("Whether to mark the filter as a favorite.")
|
|
7329
|
-
}),
|
|
7349
|
+
}), of = { filters: p.array(af).min(1).max(O.ITEMS_PER_OPERATION).describe("The filters to update.") }, sf = {
|
|
7330
7350
|
filters: p.array(Xi).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
7351
|
totalCount: p.number().describe("The total number of filters updated."),
|
|
7332
7352
|
updatedFilterIds: p.array(p.string()).describe("The IDs of the updated filters."),
|
|
@@ -7336,11 +7356,11 @@ var nf = p.object({
|
|
|
7336
7356
|
skippedCount: p.number().describe("The number of filters skipped (no changes)."),
|
|
7337
7357
|
failureCount: p.number()
|
|
7338
7358
|
}).describe("Summary of operations performed.")
|
|
7339
|
-
},
|
|
7359
|
+
}, cf = {
|
|
7340
7360
|
name: B.UPDATE_FILTERS,
|
|
7341
7361
|
description: "Update one or more existing personal filters with new values.",
|
|
7342
|
-
parameters:
|
|
7343
|
-
outputSchema:
|
|
7362
|
+
parameters: of,
|
|
7363
|
+
outputSchema: sf,
|
|
7344
7364
|
annotations: {
|
|
7345
7365
|
readOnlyHint: !1,
|
|
7346
7366
|
destructiveHint: !0,
|
|
@@ -7348,7 +7368,7 @@ var nf = p.object({
|
|
|
7348
7368
|
},
|
|
7349
7369
|
async execute(e, t) {
|
|
7350
7370
|
let { filters: n } = e, r = [], i = n.map((e) => {
|
|
7351
|
-
let t =
|
|
7371
|
+
let t = df(e);
|
|
7352
7372
|
return t === null ? (r.push(e), {
|
|
7353
7373
|
kind: "updated",
|
|
7354
7374
|
filter: e
|
|
@@ -7395,10 +7415,10 @@ var nf = p.object({
|
|
|
7395
7415
|
error: u
|
|
7396
7416
|
});
|
|
7397
7417
|
}
|
|
7398
|
-
e && (l =
|
|
7418
|
+
e && (l = lf(e, new Set(c)));
|
|
7399
7419
|
}
|
|
7400
7420
|
return {
|
|
7401
|
-
textContent: X(
|
|
7421
|
+
textContent: X(uf({
|
|
7402
7422
|
filters: l,
|
|
7403
7423
|
updatedIds: c,
|
|
7404
7424
|
skippedCount: i,
|
|
@@ -7418,7 +7438,7 @@ var nf = p.object({
|
|
|
7418
7438
|
};
|
|
7419
7439
|
}
|
|
7420
7440
|
};
|
|
7421
|
-
function
|
|
7441
|
+
function lf(e, t) {
|
|
7422
7442
|
return e.filter((e) => !e.isDeleted && t.has(e.id)).map((e) => ({
|
|
7423
7443
|
id: e.id,
|
|
7424
7444
|
name: e.name,
|
|
@@ -7429,7 +7449,7 @@ function sf(e, t) {
|
|
|
7429
7449
|
itemOrder: e.itemOrder
|
|
7430
7450
|
}));
|
|
7431
7451
|
}
|
|
7432
|
-
function
|
|
7452
|
+
function uf({ filters: e, updatedIds: t, skippedCount: n, readBackError: r }) {
|
|
7433
7453
|
let i = t.length, a = `Updated ${i} filter${i === 1 ? "" : "s"}`;
|
|
7434
7454
|
if (n > 0 && (a += ` (${n} skipped - no changes)`), r) a += `: ${t.join(", ")}\nThe updated filters could not be read back: ${r}`;
|
|
7435
7455
|
else if (e.length > 0) {
|
|
@@ -7438,23 +7458,23 @@ function cf({ filters: e, updatedIds: t, skippedCount: n, readBackError: r }) {
|
|
|
7438
7458
|
}
|
|
7439
7459
|
return a;
|
|
7440
7460
|
}
|
|
7441
|
-
function
|
|
7461
|
+
function df({ id: e, ...t }) {
|
|
7442
7462
|
return Object.values(t).every((e) => e === void 0) ? "no-fields" : null;
|
|
7443
7463
|
}
|
|
7444
7464
|
// src/tools/update-folders.ts
|
|
7445
|
-
var
|
|
7465
|
+
var ff = p.object({
|
|
7446
7466
|
id: p.string().min(1).describe("The ID of the folder to rename."),
|
|
7447
7467
|
name: p.string().min(1).describe("The new name of the folder.")
|
|
7448
|
-
}),
|
|
7468
|
+
}), pf = { folders: p.array(ff).min(1).max(O.ITEMS_PER_OPERATION).describe("The folders to rename.") }, mf = {
|
|
7449
7469
|
folders: p.array(_i).describe("The renamed folders."),
|
|
7450
7470
|
failures: p.array(Y).describe("Folders that could not be renamed, with the reason for each."),
|
|
7451
7471
|
successCount: p.number(),
|
|
7452
7472
|
failureCount: p.number()
|
|
7453
|
-
},
|
|
7473
|
+
}, hf = {
|
|
7454
7474
|
name: B.UPDATE_FOLDERS,
|
|
7455
7475
|
description: "Rename one or more workspace folders.",
|
|
7456
|
-
parameters:
|
|
7457
|
-
outputSchema:
|
|
7476
|
+
parameters: pf,
|
|
7477
|
+
outputSchema: mf,
|
|
7458
7478
|
annotations: {
|
|
7459
7479
|
readOnlyHint: !1,
|
|
7460
7480
|
destructiveHint: !0,
|
|
@@ -7463,7 +7483,7 @@ var uf = p.object({
|
|
|
7463
7483
|
async execute({ folders: e }, t) {
|
|
7464
7484
|
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
7485
|
return L(B.UPDATE_FOLDERS, e.length, r), {
|
|
7466
|
-
textContent:
|
|
7486
|
+
textContent: gf(i, r),
|
|
7467
7487
|
structuredContent: {
|
|
7468
7488
|
folders: i.map(vi),
|
|
7469
7489
|
failures: r,
|
|
@@ -7473,28 +7493,28 @@ var uf = p.object({
|
|
|
7473
7493
|
};
|
|
7474
7494
|
}
|
|
7475
7495
|
};
|
|
7476
|
-
function
|
|
7496
|
+
function gf(e, t) {
|
|
7477
7497
|
let n = e.length, r = e.map((e) => `• ${e.name} (id=${e.id})`);
|
|
7478
7498
|
return X(n > 0 ? `Renamed ${n} folder${n === 1 ? "" : "s"}:\n${r.join("\n")}` : "Renamed 0 folders", t);
|
|
7479
7499
|
}
|
|
7480
7500
|
// src/tools/update-labels.ts
|
|
7481
|
-
var
|
|
7501
|
+
var _f = p.object({
|
|
7482
7502
|
labelType: p.literal("personal").describe("Update a personal label, identified by its ID."),
|
|
7483
7503
|
id: p.string().min(1).describe("The ID of the personal label to update."),
|
|
7484
7504
|
name: p.string().min(1).max(128).optional().describe("The new name of the label."),
|
|
7485
7505
|
color: fi,
|
|
7486
7506
|
order: p.number().int().optional().describe("The new position of the label in the label list."),
|
|
7487
7507
|
isFavorite: p.boolean().optional().describe("Whether to mark the label as a favorite.")
|
|
7488
|
-
}),
|
|
7508
|
+
}), vf = p.object({
|
|
7489
7509
|
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
7510
|
name: p.string().min(1).describe("The current name of the shared label."),
|
|
7491
7511
|
newName: p.string().min(1).describe("The new name for the shared label.")
|
|
7492
|
-
}),
|
|
7512
|
+
}), yf = p.discriminatedUnion("labelType", [_f, vf]), bf = { labels: p.array(yf).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.") }, xf = p.object({
|
|
7493
7513
|
name: p.string().describe("The previous name of the shared label."),
|
|
7494
7514
|
newName: p.string().describe("The new name of the shared label.")
|
|
7495
|
-
}),
|
|
7515
|
+
}), Sf = {
|
|
7496
7516
|
updatedLabels: p.array(Ci).describe("The updated personal labels."),
|
|
7497
|
-
renamedSharedLabels: p.array(
|
|
7517
|
+
renamedSharedLabels: p.array(xf).describe("The shared labels that were renamed."),
|
|
7498
7518
|
totalCount: p.number().describe("The total number of successful operations (personal + shared)."),
|
|
7499
7519
|
failures: p.array(Y).describe("Labels that could not be updated, identified by ID (personal) or name (shared), with the reason for each."),
|
|
7500
7520
|
appliedOperations: p.object({
|
|
@@ -7503,11 +7523,11 @@ var hf = p.object({
|
|
|
7503
7523
|
skippedCount: p.number().describe("Number of operations skipped (no changes or shared label not found)."),
|
|
7504
7524
|
failureCount: p.number()
|
|
7505
7525
|
}).describe("Summary of operations performed.")
|
|
7506
|
-
},
|
|
7526
|
+
}, Cf = {
|
|
7507
7527
|
name: B.UPDATE_LABELS,
|
|
7508
7528
|
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:
|
|
7529
|
+
parameters: bf,
|
|
7530
|
+
outputSchema: Sf,
|
|
7511
7531
|
annotations: {
|
|
7512
7532
|
readOnlyHint: !1,
|
|
7513
7533
|
destructiveHint: !0,
|
|
@@ -7516,7 +7536,7 @@ var hf = p.object({
|
|
|
7516
7536
|
async execute(e, t) {
|
|
7517
7537
|
let { labels: n } = e, { succeeded: r, failures: i } = I(n, await Promise.allSettled(n.map(async (e) => {
|
|
7518
7538
|
if (e.labelType === "personal") {
|
|
7519
|
-
let n =
|
|
7539
|
+
let n = Tf(e);
|
|
7520
7540
|
if (n !== null) return {
|
|
7521
7541
|
kind: "skipped",
|
|
7522
7542
|
reason: n
|
|
@@ -7545,7 +7565,7 @@ var hf = p.object({
|
|
|
7545
7565
|
newName: t
|
|
7546
7566
|
})), 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
7567
|
return {
|
|
7548
|
-
textContent: X(
|
|
7568
|
+
textContent: X(wf({
|
|
7549
7569
|
updatedLabels: o,
|
|
7550
7570
|
renamedSharedLabels: s,
|
|
7551
7571
|
skippedNoFields: l,
|
|
@@ -7566,7 +7586,7 @@ var hf = p.object({
|
|
|
7566
7586
|
};
|
|
7567
7587
|
}
|
|
7568
7588
|
};
|
|
7569
|
-
function
|
|
7589
|
+
function wf({ updatedLabels: e, renamedSharedLabels: t, skippedNoFields: n, skippedNotFound: r }) {
|
|
7570
7590
|
let i = e.length, a = t.length, o = i + a, s = [];
|
|
7571
7591
|
s.push(`Updated ${o} label${o === 1 ? "" : "s"} (${i} personal, ${a} shared)`);
|
|
7572
7592
|
let c = [];
|
|
@@ -7580,11 +7600,11 @@ function Sf({ updatedLabels: e, renamedSharedLabels: t, skippedNoFields: n, skip
|
|
|
7580
7600
|
}
|
|
7581
7601
|
return s.join("\n");
|
|
7582
7602
|
}
|
|
7583
|
-
function
|
|
7603
|
+
function Tf({ id: e, labelType: t, ...n }) {
|
|
7584
7604
|
return Object.values(n).every((e) => e === void 0) ? "no-fields" : null;
|
|
7585
7605
|
}
|
|
7586
7606
|
// src/tools/update-projects.ts
|
|
7587
|
-
var { FIND_FOLDERS:
|
|
7607
|
+
var { FIND_FOLDERS: Ef } = B, Df = p.object({
|
|
7588
7608
|
id: p.string().min(1).describe("The ID of the project to update."),
|
|
7589
7609
|
name: p.string().min(1).optional().describe("The new name of the project."),
|
|
7590
7610
|
isFavorite: p.boolean().optional().describe("Whether the project is a favorite."),
|
|
@@ -7592,8 +7612,8 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7592
7612
|
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
7613
|
color: fi,
|
|
7594
7614
|
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
|
-
}),
|
|
7615
|
+
folderId: p.string().min(1).optional().describe(`Move a workspace project into this folder (see ${Ef}), or "remove" for the workspace's top level.`)
|
|
7616
|
+
}), Of = { projects: p.array(Df).min(1).max(O.ITEMS_PER_OPERATION).describe("The projects to update.") }, kf = {
|
|
7597
7617
|
projects: p.array(mi).describe("The updated projects."),
|
|
7598
7618
|
totalCount: p.number().describe("The total number of projects updated."),
|
|
7599
7619
|
updatedProjectIds: p.array(p.string()).describe("The IDs of the updated projects."),
|
|
@@ -7603,11 +7623,11 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7603
7623
|
skippedCount: p.number().describe("The number of projects skipped (no changes)."),
|
|
7604
7624
|
failureCount: p.number()
|
|
7605
7625
|
}).describe("Summary of operations performed.")
|
|
7606
|
-
},
|
|
7626
|
+
}, Af = {
|
|
7607
7627
|
name: B.UPDATE_PROJECTS,
|
|
7608
7628
|
description: "Update multiple existing projects with new values.",
|
|
7609
|
-
parameters:
|
|
7610
|
-
outputSchema:
|
|
7629
|
+
parameters: Of,
|
|
7630
|
+
outputSchema: kf,
|
|
7611
7631
|
annotations: {
|
|
7612
7632
|
readOnlyHint: !1,
|
|
7613
7633
|
destructiveHint: !0,
|
|
@@ -7615,7 +7635,7 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7615
7635
|
},
|
|
7616
7636
|
async execute(e, t) {
|
|
7617
7637
|
let { projects: n } = e, { succeeded: r, failures: i } = I(n, await Promise.allSettled(n.map(async (e) => {
|
|
7618
|
-
let n =
|
|
7638
|
+
let n = Mf(e);
|
|
7619
7639
|
if (n !== null) return {
|
|
7620
7640
|
kind: "skipped",
|
|
7621
7641
|
reason: n
|
|
@@ -7632,7 +7652,7 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7632
7652
|
})), (e) => e.id), a = [], o = 0, s = 0;
|
|
7633
7653
|
for (let { value: e } of r) e.kind === "updated" ? a.push(Jr(e.project)) : e.reason === "no-fields" ? o++ : s++;
|
|
7634
7654
|
return L(B.UPDATE_PROJECTS, n.length, i), {
|
|
7635
|
-
textContent:
|
|
7655
|
+
textContent: jf({
|
|
7636
7656
|
projects: a,
|
|
7637
7657
|
skippedNoFields: o,
|
|
7638
7658
|
skippedNoValidValues: s,
|
|
@@ -7652,30 +7672,30 @@ var { FIND_FOLDERS: wf } = B, Tf = p.object({
|
|
|
7652
7672
|
};
|
|
7653
7673
|
}
|
|
7654
7674
|
};
|
|
7655
|
-
function
|
|
7675
|
+
function jf({ projects: e, skippedNoFields: t, skippedNoValidValues: n, failures: r }) {
|
|
7656
7676
|
let i = e.length, a = e.map((e) => `• ${e.name} (id=${e.id})`).join("\n"), o = `Updated ${i} project${i === 1 ? "" : "s"}`, s = [];
|
|
7657
7677
|
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}`), X(o, r);
|
|
7658
7678
|
}
|
|
7659
|
-
function
|
|
7679
|
+
function Mf({ id: e, ...t }) {
|
|
7660
7680
|
let n = Object.values(t);
|
|
7661
7681
|
return n.length === 0 ? "no-fields" : n.every((e) => e === void 0) ? "no-valid-values" : null;
|
|
7662
7682
|
}
|
|
7663
7683
|
// src/tools/update-reminders.ts
|
|
7664
|
-
var
|
|
7684
|
+
var Nf = p.object({
|
|
7665
7685
|
type: p.literal("relative"),
|
|
7666
7686
|
id: p.string().min(1).describe("The ID of the relative reminder to update."),
|
|
7667
7687
|
minuteOffset: p.number().int().min(0).optional().describe("New minute offset before task due time."),
|
|
7668
7688
|
service: qa.optional().describe("New delivery method: \"email\" or \"push\"."),
|
|
7669
7689
|
isUrgent: Xa,
|
|
7670
7690
|
notifyUser: $a
|
|
7671
|
-
}),
|
|
7691
|
+
}), Pf = p.object({
|
|
7672
7692
|
type: p.literal("absolute"),
|
|
7673
7693
|
id: p.string().min(1).describe("The ID of the absolute reminder to update."),
|
|
7674
7694
|
due: Ja.optional().describe("New due date/time for the reminder."),
|
|
7675
7695
|
service: qa.optional().describe("New delivery method: \"email\" or \"push\"."),
|
|
7676
7696
|
isUrgent: Xa,
|
|
7677
7697
|
notifyUser: $a
|
|
7678
|
-
}),
|
|
7698
|
+
}), Ff = p.object({
|
|
7679
7699
|
type: p.literal("location"),
|
|
7680
7700
|
id: p.string().min(1).describe("The ID of the location reminder to update."),
|
|
7681
7701
|
name: p.string().optional().describe("New location name."),
|
|
@@ -7684,11 +7704,11 @@ var jf = p.object({
|
|
|
7684
7704
|
locTrigger: Ya.optional().describe("New trigger condition: \"on_enter\" or \"on_leave\"."),
|
|
7685
7705
|
radius: p.number().int().optional().describe("New radius in meters."),
|
|
7686
7706
|
notifyUser: $a
|
|
7687
|
-
}),
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
]),
|
|
7707
|
+
}), If = p.discriminatedUnion("type", [
|
|
7708
|
+
Nf,
|
|
7709
|
+
Pf,
|
|
7710
|
+
Ff
|
|
7711
|
+
]), Lf = { reminders: p.array(If).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.") }, Rf = {
|
|
7692
7712
|
reminders: p.array(Ti).describe("The updated reminders."),
|
|
7693
7713
|
totalCount: p.number().describe("Total reminders updated."),
|
|
7694
7714
|
updatedReminderIds: p.array(p.string()).describe("IDs of updated reminders."),
|
|
@@ -7697,11 +7717,11 @@ var jf = p.object({
|
|
|
7697
7717
|
updateCount: p.number(),
|
|
7698
7718
|
failureCount: p.number()
|
|
7699
7719
|
})
|
|
7700
|
-
},
|
|
7720
|
+
}, zf = {
|
|
7701
7721
|
name: B.UPDATE_REMINDERS,
|
|
7702
7722
|
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:
|
|
7723
|
+
parameters: Lf,
|
|
7724
|
+
outputSchema: Rf,
|
|
7705
7725
|
annotations: {
|
|
7706
7726
|
readOnlyHint: !1,
|
|
7707
7727
|
destructiveHint: !0,
|
|
@@ -7758,12 +7778,12 @@ var jf = p.object({
|
|
|
7758
7778
|
}
|
|
7759
7779
|
};
|
|
7760
7780
|
}
|
|
7761
|
-
},
|
|
7781
|
+
}, Bf = p.object({
|
|
7762
7782
|
id: p.string().min(1).describe("The ID of the section to update."),
|
|
7763
7783
|
name: p.string().min(1).optional().describe("The new name of the section."),
|
|
7764
7784
|
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
7785
|
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." }),
|
|
7786
|
+
}).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." }), Vf = { sections: p.array(Bf).min(1).max(O.ITEMS_PER_OPERATION).describe("The sections to update.") }, Hf = {
|
|
7767
7787
|
sections: p.array(hi).describe("The updated sections."),
|
|
7768
7788
|
totalCount: p.number().describe("The total number of sections updated."),
|
|
7769
7789
|
updatedSectionIds: p.array(p.string()).describe("The IDs of the updated sections."),
|
|
@@ -7772,27 +7792,27 @@ var jf = p.object({
|
|
|
7772
7792
|
updateCount: p.number(),
|
|
7773
7793
|
failureCount: p.number()
|
|
7774
7794
|
})
|
|
7775
|
-
},
|
|
7795
|
+
}, Uf = {
|
|
7776
7796
|
name: B.UPDATE_SECTIONS,
|
|
7777
7797
|
description: "Update, archive or unarchive multiple existing sections.",
|
|
7778
|
-
parameters:
|
|
7779
|
-
outputSchema:
|
|
7798
|
+
parameters: Vf,
|
|
7799
|
+
outputSchema: Hf,
|
|
7780
7800
|
annotations: {
|
|
7781
7801
|
readOnlyHint: !1,
|
|
7782
7802
|
destructiveHint: !0,
|
|
7783
7803
|
idempotentHint: !1
|
|
7784
7804
|
},
|
|
7785
7805
|
async execute({ sections: e }, t) {
|
|
7786
|
-
let n = I(e, await Promise.allSettled(e.map((e) =>
|
|
7806
|
+
let n = I(e, await Promise.allSettled(e.map((e) => Gf(e, t))), (e) => e.id), r = n.succeeded.map(({ item: e, value: t }) => ({
|
|
7787
7807
|
id: e.id,
|
|
7788
7808
|
...t
|
|
7789
7809
|
})), i = [...n.failures, ...r.flatMap(({ id: e, partial: t }) => t ? [{
|
|
7790
7810
|
item: e,
|
|
7791
7811
|
...t,
|
|
7792
|
-
code:
|
|
7812
|
+
code: Wf
|
|
7793
7813
|
}] : [])], a = r.map(({ section: e }) => e);
|
|
7794
7814
|
return L(B.UPDATE_SECTIONS, e.length, i), {
|
|
7795
|
-
textContent:
|
|
7815
|
+
textContent: qf({
|
|
7796
7816
|
updated: r.map(({ section: e, archiveChange: t }) => ({
|
|
7797
7817
|
section: e,
|
|
7798
7818
|
isArchived: t
|
|
@@ -7811,8 +7831,8 @@ var jf = p.object({
|
|
|
7811
7831
|
}
|
|
7812
7832
|
};
|
|
7813
7833
|
}
|
|
7814
|
-
},
|
|
7815
|
-
async function
|
|
7834
|
+
}, Wf = "PARTIAL_UPDATE_APPLIED";
|
|
7835
|
+
async function Gf({ id: e, name: t, description: n, isArchived: r }, i) {
|
|
7816
7836
|
let a = [];
|
|
7817
7837
|
if (r === !1 && a.push({
|
|
7818
7838
|
label: "unarchive",
|
|
@@ -7852,37 +7872,37 @@ async function Uf({ id: e, name: t, description: n, isArchived: r }, i) {
|
|
|
7852
7872
|
}
|
|
7853
7873
|
return o;
|
|
7854
7874
|
}
|
|
7855
|
-
var
|
|
7875
|
+
var Kf = {
|
|
7856
7876
|
true: " - archived",
|
|
7857
7877
|
false: " - unarchived"
|
|
7858
7878
|
};
|
|
7859
|
-
function
|
|
7879
|
+
function qf({ updated: e, failures: t }) {
|
|
7860
7880
|
let n = e.length, r = e.map(({ section: e, isArchived: t }) => {
|
|
7861
|
-
let n = t === void 0 ? "" :
|
|
7881
|
+
let n = t === void 0 ? "" : Kf[`${t}`];
|
|
7862
7882
|
return `• ${e.name} (id=${e.id}, projectId=${e.projectId})${n}`;
|
|
7863
7883
|
}).join("\n");
|
|
7864
7884
|
return X(n > 0 ? `Updated ${n} section${n === 1 ? "" : "s"}:\n${r}` : "Updated 0 sections", t);
|
|
7865
7885
|
}
|
|
7866
7886
|
// src/utils/move-planner.ts
|
|
7867
|
-
function
|
|
7887
|
+
function Jf(e, t) {
|
|
7868
7888
|
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
7889
|
}
|
|
7870
|
-
function
|
|
7890
|
+
function Yf(e, t) {
|
|
7871
7891
|
return t.projectId === void 0 ? t.sectionId === void 0 ? e.parentId === t.parentId : e.sectionId === t.sectionId : e.projectId === t.projectId;
|
|
7872
7892
|
}
|
|
7873
|
-
function
|
|
7893
|
+
function Xf(e) {
|
|
7874
7894
|
return e.projectId === void 0 ? e.sectionId === void 0 ? `parent:${e.parentId}` : `section:${e.sectionId}` : `project:${e.projectId}`;
|
|
7875
7895
|
}
|
|
7876
|
-
function
|
|
7896
|
+
function Zf(e) {
|
|
7877
7897
|
let t = [];
|
|
7878
7898
|
return e.projectId && t.push({ projectId: e.projectId }), e.sectionId && t.push({ sectionId: e.sectionId }), e.parentId && t.push({ parentId: e.parentId }), t;
|
|
7879
7899
|
}
|
|
7880
|
-
function
|
|
7881
|
-
let r =
|
|
7900
|
+
function Qf({ taskId: e, request: t, current: n }) {
|
|
7901
|
+
let r = Zf(t);
|
|
7882
7902
|
if (r.length === 0) return { redundantMoveSkipped: !1 };
|
|
7883
7903
|
let i = r, a = !1;
|
|
7884
7904
|
if (n) {
|
|
7885
|
-
let e = r.length === 1 ? (e) =>
|
|
7905
|
+
let e = r.length === 1 ? (e) => Jf(n, e) : (e) => Yf(n, e);
|
|
7886
7906
|
i = r.filter((t) => !e(t)), a = i.length < r.length;
|
|
7887
7907
|
}
|
|
7888
7908
|
if (i.length === 0) return { redundantMoveSkipped: a };
|
|
@@ -7893,7 +7913,7 @@ function Xf({ taskId: e, request: t, current: n }) {
|
|
|
7893
7913
|
};
|
|
7894
7914
|
}
|
|
7895
7915
|
// src/tools/update-tasks.ts
|
|
7896
|
-
var
|
|
7916
|
+
var $f = p.object({
|
|
7897
7917
|
id: p.string().min(1).describe("The ID of the task to update."),
|
|
7898
7918
|
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
7919
|
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,11 +7929,11 @@ var Zf = p.object({
|
|
|
7909
7929
|
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
7930
|
labels: p.array(p.string()).max(O.LABELS_PER_TASK).optional().describe("The new labels for the task. Replaces all existing labels."),
|
|
7911
7931
|
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
|
-
}),
|
|
7932
|
+
}), ep = (e) => !!(e.projectId || e.sectionId || e.parentId), tp = (e) => Object.keys(e).length > 0, np = ["remove", "no date"], rp = [
|
|
7913
7933
|
"remove",
|
|
7914
7934
|
"no date",
|
|
7915
7935
|
"no deadline"
|
|
7916
|
-
],
|
|
7936
|
+
], ip = "no date", ap = O.TASKS_PER_OPERATION, op = { tasks: p.array($f).min(1).max(ap).describe(`The tasks to update (max ${ap}).`) }, sp = {
|
|
7917
7937
|
tasks: p.array(J).describe("The updated tasks."),
|
|
7918
7938
|
totalCount: p.number().describe("The total number of tasks updated."),
|
|
7919
7939
|
updatedTaskIds: p.array(p.string()).describe("The IDs of the updated tasks."),
|
|
@@ -7924,11 +7944,11 @@ var Zf = p.object({
|
|
|
7924
7944
|
failureCount: p.number(),
|
|
7925
7945
|
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
7946
|
}).describe("Summary of operations performed.")
|
|
7927
|
-
},
|
|
7947
|
+
}, cp = {
|
|
7928
7948
|
name: B.UPDATE_TASKS,
|
|
7929
7949
|
description: "Update existing tasks including content, dates, priorities, and assignments. Send only the fields that change.",
|
|
7930
|
-
parameters:
|
|
7931
|
-
outputSchema:
|
|
7950
|
+
parameters: op,
|
|
7951
|
+
outputSchema: sp,
|
|
7932
7952
|
annotations: {
|
|
7933
7953
|
readOnlyHint: !1,
|
|
7934
7954
|
destructiveHint: !0,
|
|
@@ -7936,7 +7956,7 @@ var Zf = p.object({
|
|
|
7936
7956
|
openWorldHint: !0
|
|
7937
7957
|
},
|
|
7938
7958
|
async execute(e, t) {
|
|
7939
|
-
let { tasks: n } = p.object(
|
|
7959
|
+
let { tasks: n } = p.object(op).parse(e), r = n.map(() => ({ kind: "skipped" })), i = (e, t, n) => {
|
|
7940
7960
|
r[e] = {
|
|
7941
7961
|
kind: "failed",
|
|
7942
7962
|
error: t,
|
|
@@ -7947,7 +7967,7 @@ var Zf = p.object({
|
|
|
7947
7967
|
}, o = n.map((e, t) => ({
|
|
7948
7968
|
task: e,
|
|
7949
7969
|
index: t
|
|
7950
|
-
})).filter(({ task: e }) =>
|
|
7970
|
+
})).filter(({ task: e }) => yp(e)), s = await up(o.map(({ task: e }) => e), t), c = await Promise.allSettled(o.map(({ task: e, index: n }) => gp({
|
|
7951
7971
|
task: e,
|
|
7952
7972
|
index: n,
|
|
7953
7973
|
client: t,
|
|
@@ -7957,13 +7977,13 @@ var Zf = p.object({
|
|
|
7957
7977
|
let n = o[e]?.index ?? e;
|
|
7958
7978
|
t.status === "fulfilled" ? l.push(t.value) : a(n, t.reason);
|
|
7959
7979
|
}
|
|
7960
|
-
let { states: u, readFailed: d } = await
|
|
7980
|
+
let { states: u, readFailed: d } = await dp({
|
|
7961
7981
|
client: t,
|
|
7962
|
-
ids: [...new Set(l.filter((e) =>
|
|
7982
|
+
ids: [...new Set(l.filter((e) => ep(e.moveRequest) || e.checkRecurrence).map((e) => e.id))]
|
|
7963
7983
|
});
|
|
7964
7984
|
for (let e of l) {
|
|
7965
7985
|
if (!e.checkRecurrence) continue;
|
|
7966
|
-
let t =
|
|
7986
|
+
let t = fp({
|
|
7967
7987
|
id: e.id,
|
|
7968
7988
|
current: u.get(e.id),
|
|
7969
7989
|
readFailed: d
|
|
@@ -7972,7 +7992,7 @@ var Zf = p.object({
|
|
|
7972
7992
|
}
|
|
7973
7993
|
let f = [];
|
|
7974
7994
|
for (let e of l) if (!e.failed) try {
|
|
7975
|
-
let t =
|
|
7995
|
+
let t = Qf({
|
|
7976
7996
|
taskId: e.id,
|
|
7977
7997
|
request: e.moveRequest,
|
|
7978
7998
|
current: u.get(e.id)
|
|
@@ -7986,7 +8006,7 @@ var Zf = p.object({
|
|
|
7986
8006
|
}
|
|
7987
8007
|
let m = /* @__PURE__ */ new Map(), h = [], g = (e) => {
|
|
7988
8008
|
let n = e.filter((e) => !e.failed);
|
|
7989
|
-
n.length !== 0 && h.push(
|
|
8009
|
+
n.length !== 0 && h.push(hp({
|
|
7990
8010
|
client: t,
|
|
7991
8011
|
items: n,
|
|
7992
8012
|
onUpdated: (e, t) => {
|
|
@@ -8006,7 +8026,7 @@ var Zf = p.object({
|
|
|
8006
8026
|
}
|
|
8007
8027
|
}));
|
|
8008
8028
|
}, _ = new Set(f.map(({ item: e }) => e.index));
|
|
8009
|
-
g(l.filter((e) => !_.has(e.index))), await
|
|
8029
|
+
g(l.filter((e) => !_.has(e.index))), await pp({
|
|
8010
8030
|
client: t,
|
|
8011
8031
|
moving: f,
|
|
8012
8032
|
results: m,
|
|
@@ -8020,19 +8040,19 @@ var Zf = p.object({
|
|
|
8020
8040
|
}
|
|
8021
8041
|
}), await Promise.all(h);
|
|
8022
8042
|
for (let e of l) {
|
|
8023
|
-
if (e.failed ||
|
|
8043
|
+
if (e.failed || tp(e.updateArgs)) continue;
|
|
8024
8044
|
let t = m.get(e.index);
|
|
8025
8045
|
t && "task" in t && (r[e.index] = {
|
|
8026
8046
|
kind: "updated",
|
|
8027
8047
|
task: t.task
|
|
8028
8048
|
});
|
|
8029
8049
|
}
|
|
8030
|
-
let { updatedTasks: v, failures: y, skippedCount: b } =
|
|
8050
|
+
let { updatedTasks: v, failures: y, skippedCount: b } = lp({
|
|
8031
8051
|
tasks: n,
|
|
8032
8052
|
outcomes: r
|
|
8033
8053
|
}), x = l.filter((e) => e.redundantMoveSkipped).length, S = v.map(K);
|
|
8034
8054
|
return L(B.UPDATE_TASKS, n.length, y), {
|
|
8035
|
-
textContent:
|
|
8055
|
+
textContent: vp({
|
|
8036
8056
|
tasks: S,
|
|
8037
8057
|
failures: y,
|
|
8038
8058
|
skippedCount: b,
|
|
@@ -8053,7 +8073,7 @@ var Zf = p.object({
|
|
|
8053
8073
|
};
|
|
8054
8074
|
}
|
|
8055
8075
|
};
|
|
8056
|
-
function
|
|
8076
|
+
function lp({ tasks: e, outcomes: t }) {
|
|
8057
8077
|
let n = [], r = [], i = 0;
|
|
8058
8078
|
for (let [a, o] of t.entries()) {
|
|
8059
8079
|
let t = e[a]?.id ?? `Task ${a + 1}`;
|
|
@@ -8074,7 +8094,7 @@ function sp({ tasks: e, outcomes: t }) {
|
|
|
8074
8094
|
skippedCount: i
|
|
8075
8095
|
};
|
|
8076
8096
|
}
|
|
8077
|
-
async function
|
|
8097
|
+
async function up(e, t) {
|
|
8078
8098
|
if (!e.some((e) => U(e.projectId))) return {};
|
|
8079
8099
|
try {
|
|
8080
8100
|
return { projectId: (await R(() => t.getUser())).inboxProjectId };
|
|
@@ -8082,7 +8102,7 @@ async function cp(e, t) {
|
|
|
8082
8102
|
return { error: e };
|
|
8083
8103
|
}
|
|
8084
8104
|
}
|
|
8085
|
-
async function
|
|
8105
|
+
async function dp({ client: e, ids: t }) {
|
|
8086
8106
|
let n = /* @__PURE__ */ new Map();
|
|
8087
8107
|
if (t.length === 0) return {
|
|
8088
8108
|
states: n,
|
|
@@ -8091,7 +8111,7 @@ async function lp({ client: e, ids: t }) {
|
|
|
8091
8111
|
try {
|
|
8092
8112
|
let r = new Set(t), i = {
|
|
8093
8113
|
ids: t,
|
|
8094
|
-
limit:
|
|
8114
|
+
limit: ap
|
|
8095
8115
|
}, { results: a } = await R(() => e.getTasks(i));
|
|
8096
8116
|
for (let e of a) r.has(e.id) && n.set(e.id, e);
|
|
8097
8117
|
} catch (e) {
|
|
@@ -8106,15 +8126,15 @@ async function lp({ client: e, ids: t }) {
|
|
|
8106
8126
|
readFailed: !1
|
|
8107
8127
|
};
|
|
8108
8128
|
}
|
|
8109
|
-
function
|
|
8129
|
+
function fp({ id: e, current: t, readFailed: n }) {
|
|
8110
8130
|
if (n) return `Task ${e}: could not check whether the task is recurring, so its due date was not changed. Retry the update.`;
|
|
8111
8131
|
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
8132
|
}
|
|
8113
|
-
async function
|
|
8133
|
+
async function pp({ client: e, moving: t, results: n, onResolved: r }) {
|
|
8114
8134
|
if (t.length === 0) return;
|
|
8115
8135
|
let i = /* @__PURE__ */ new Map();
|
|
8116
8136
|
for (let e of t) {
|
|
8117
|
-
let t =
|
|
8137
|
+
let t = Xf(e.move), n = i.get(t);
|
|
8118
8138
|
n ? n.push(e) : i.set(t, [e]);
|
|
8119
8139
|
}
|
|
8120
8140
|
let a = It(e), o = [];
|
|
@@ -8151,7 +8171,7 @@ async function dp({ client: e, moving: t, results: n, onResolved: r }) {
|
|
|
8151
8171
|
}
|
|
8152
8172
|
}
|
|
8153
8173
|
if (o.length > 0) {
|
|
8154
|
-
await
|
|
8174
|
+
await mp({
|
|
8155
8175
|
client: e,
|
|
8156
8176
|
unresolved: o,
|
|
8157
8177
|
results: n
|
|
@@ -8159,8 +8179,8 @@ async function dp({ client: e, moving: t, results: n, onResolved: r }) {
|
|
|
8159
8179
|
for (let { group: e } of o) r(e);
|
|
8160
8180
|
}
|
|
8161
8181
|
}
|
|
8162
|
-
async function
|
|
8163
|
-
let { states: r, rateLimit: i } = await
|
|
8182
|
+
async function mp({ client: e, unresolved: t, results: n }) {
|
|
8183
|
+
let { states: r, rateLimit: i } = await dp({
|
|
8164
8184
|
client: e,
|
|
8165
8185
|
ids: [...new Set(t.flatMap(({ group: e }) => e.map(({ item: e }) => e.id)))]
|
|
8166
8186
|
});
|
|
@@ -8171,16 +8191,16 @@ async function fp({ client: e, unresolved: t, results: n }) {
|
|
|
8171
8191
|
}, u = o === void 0 ? "Task not returned by the move" : P(o);
|
|
8172
8192
|
for (let { item: t } of e) {
|
|
8173
8193
|
let e = r.get(t.id);
|
|
8174
|
-
e &&
|
|
8194
|
+
e && Jf(e, a) ? n.set(t.index, { task: e }) : n.set(t.index, {
|
|
8175
8195
|
error: u,
|
|
8176
8196
|
rateLimit: l
|
|
8177
8197
|
});
|
|
8178
8198
|
}
|
|
8179
8199
|
}
|
|
8180
8200
|
}
|
|
8181
|
-
async function
|
|
8201
|
+
async function hp({ client: e, items: t, onUpdated: n, onFailed: r }) {
|
|
8182
8202
|
let i = Lt(e);
|
|
8183
|
-
await Promise.all(t.filter((e) =>
|
|
8203
|
+
await Promise.all(t.filter((e) => tp(e.updateArgs)).map(async (t) => {
|
|
8184
8204
|
try {
|
|
8185
8205
|
n(t, await i(() => R(() => e.updateTask(t.id, t.updateArgs))));
|
|
8186
8206
|
} catch (e) {
|
|
@@ -8188,7 +8208,7 @@ async function pp({ client: e, items: t, onUpdated: n, onFailed: r }) {
|
|
|
8188
8208
|
}
|
|
8189
8209
|
}));
|
|
8190
8210
|
}
|
|
8191
|
-
async function
|
|
8211
|
+
async function gp({ task: e, index: t, client: n, inbox: r }) {
|
|
8192
8212
|
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
8213
|
if (U(a) && r.error !== void 0) throw r.error;
|
|
8194
8214
|
let g = U(a) ? r.projectId : a, _ = {
|
|
@@ -8196,12 +8216,12 @@ async function mp({ task: e, index: t, client: n, inbox: r }) {
|
|
|
8196
8216
|
...f !== void 0 && { labels: f }
|
|
8197
8217
|
};
|
|
8198
8218
|
d && (_.priority = cr(d));
|
|
8199
|
-
let v =
|
|
8219
|
+
let v = bp(c, np, ip);
|
|
8200
8220
|
v !== void 0 && (_ = {
|
|
8201
8221
|
..._,
|
|
8202
8222
|
dueString: v
|
|
8203
8223
|
});
|
|
8204
|
-
let y =
|
|
8224
|
+
let y = bp(p, rp, null);
|
|
8205
8225
|
if (y !== void 0 && (_ = {
|
|
8206
8226
|
..._,
|
|
8207
8227
|
deadlineDate: y
|
|
@@ -8215,7 +8235,7 @@ async function mp({ task: e, index: t, client: n, inbox: r }) {
|
|
|
8215
8235
|
}
|
|
8216
8236
|
return u !== void 0 && (_ = {
|
|
8217
8237
|
..._,
|
|
8218
|
-
assigneeId: await
|
|
8238
|
+
assigneeId: await _p(n, i, u)
|
|
8219
8239
|
}), {
|
|
8220
8240
|
index: t,
|
|
8221
8241
|
id: i,
|
|
@@ -8226,11 +8246,11 @@ async function mp({ task: e, index: t, client: n, inbox: r }) {
|
|
|
8226
8246
|
parentId: s
|
|
8227
8247
|
},
|
|
8228
8248
|
redundantMoveSkipped: !1,
|
|
8229
|
-
checkRecurrence: v !== void 0 && v !==
|
|
8249
|
+
checkRecurrence: v !== void 0 && v !== ip && m !== !0,
|
|
8230
8250
|
failed: !1
|
|
8231
8251
|
};
|
|
8232
8252
|
}
|
|
8233
|
-
async function
|
|
8253
|
+
async function _p(e, t, n) {
|
|
8234
8254
|
if (n === null || n === "unassign") return null;
|
|
8235
8255
|
let r = await go.validateTaskUpdateAssignment(e, t, n);
|
|
8236
8256
|
if (!r.isValid) {
|
|
@@ -8239,7 +8259,7 @@ async function hp(e, t, n) {
|
|
|
8239
8259
|
}
|
|
8240
8260
|
return r.resolvedUser?.userId;
|
|
8241
8261
|
}
|
|
8242
|
-
function
|
|
8262
|
+
function vp({ tasks: e, failures: t, skippedCount: n, redundantMovesSkipped: r }) {
|
|
8243
8263
|
let i = [];
|
|
8244
8264
|
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
8265
|
let a = Ni("Updated", e, {
|
|
@@ -8250,17 +8270,17 @@ function gp({ tasks: e, failures: t, skippedCount: n, redundantMovesSkipped: r }
|
|
|
8250
8270
|
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
8271
|
return `${a}\nFailed (${t.length}) - address or drop these items:\n${c}${l}`;
|
|
8252
8272
|
}
|
|
8253
|
-
function
|
|
8273
|
+
function yp({ id: e, replaceRecurrence: t, ...n }) {
|
|
8254
8274
|
return Object.keys(n).length > 0;
|
|
8255
8275
|
}
|
|
8256
|
-
function
|
|
8276
|
+
function bp(e, t, n) {
|
|
8257
8277
|
if (e === void 0) return e;
|
|
8258
8278
|
if (e === null) return n;
|
|
8259
8279
|
let r = e.trim().toLowerCase();
|
|
8260
8280
|
return t.includes(r) ? n : e;
|
|
8261
8281
|
}
|
|
8262
8282
|
// src/tools/update-template.ts
|
|
8263
|
-
var
|
|
8283
|
+
var xp = {
|
|
8264
8284
|
templateId: p.string().regex(Ca).describe("A saved template ID (\"UT_28Ex...\") or its Todoist URL."),
|
|
8265
8285
|
name: p.string().trim().min(1).optional(),
|
|
8266
8286
|
description: p.string().trim().min(1).optional(),
|
|
@@ -8269,16 +8289,16 @@ var yp = {
|
|
|
8269
8289
|
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
8290
|
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
8291
|
sharedWithWorkspaceMembers: p.boolean().optional().describe("Share a workspace template with its members, or stop sharing it. Only the author can change this.")
|
|
8272
|
-
},
|
|
8292
|
+
}, Sp = {
|
|
8273
8293
|
templateId: p.string(),
|
|
8274
8294
|
name: p.string(),
|
|
8275
8295
|
workspaceId: p.string().optional().describe("Absent for personal templates."),
|
|
8276
8296
|
sharedWithWorkspaceMembers: p.boolean()
|
|
8277
|
-
},
|
|
8297
|
+
}, Cp = {
|
|
8278
8298
|
name: B.UPDATE_TEMPLATE,
|
|
8279
8299
|
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:
|
|
8300
|
+
parameters: xp,
|
|
8301
|
+
outputSchema: Sp,
|
|
8282
8302
|
annotations: {
|
|
8283
8303
|
readOnlyHint: !1,
|
|
8284
8304
|
destructiveHint: !0,
|
|
@@ -8298,7 +8318,7 @@ var yp = {
|
|
|
8298
8318
|
s
|
|
8299
8319
|
].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
8320
|
if (a && i) throw Error("Provide either `content` or `projectId`, not both: each replaces the whole content.");
|
|
8301
|
-
let u = a ?
|
|
8321
|
+
let u = a ? Ro(a) : void 0, [d, f] = await Promise.all([u ? wp(c, l, "before") : void 0, o ? oa.resolveWorkspace(c, o).then((e) => e.workspaceId) : void 0]), p = await c.updateTemplate(l, {
|
|
8302
8322
|
name: t,
|
|
8303
8323
|
description: n,
|
|
8304
8324
|
color: r,
|
|
@@ -8308,11 +8328,11 @@ var yp = {
|
|
|
8308
8328
|
sharedWithWorkspaceMembers: s
|
|
8309
8329
|
}), 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
8330
|
if (u) {
|
|
8311
|
-
let e = await
|
|
8331
|
+
let e = await wp(c, l, "after");
|
|
8312
8332
|
if (!e) _ = " The content was saved, but could not be read back to compare.";
|
|
8313
8333
|
else {
|
|
8314
|
-
_ = d ? ` Content: ${
|
|
8315
|
-
let t =
|
|
8334
|
+
_ = d ? ` Content: ${Bo(d, e)}.` : " The previous content could not be read, so the change is not reported.";
|
|
8335
|
+
let t = Vo(u, e);
|
|
8316
8336
|
t && (_ += ` Not everything sent was kept: ${t}.`);
|
|
8317
8337
|
}
|
|
8318
8338
|
}
|
|
@@ -8327,7 +8347,7 @@ var yp = {
|
|
|
8327
8347
|
};
|
|
8328
8348
|
}
|
|
8329
8349
|
};
|
|
8330
|
-
async function
|
|
8350
|
+
async function wp(e, t, n) {
|
|
8331
8351
|
try {
|
|
8332
8352
|
return (await R(() => e.getTemplateContent(t))).content;
|
|
8333
8353
|
} catch (e) {
|
|
@@ -8336,7 +8356,7 @@ async function Sp(e, t, n) {
|
|
|
8336
8356
|
}
|
|
8337
8357
|
}
|
|
8338
8358
|
// src/tools/user-info.ts
|
|
8339
|
-
var
|
|
8359
|
+
var Tp = {}, Ep = {
|
|
8340
8360
|
type: p.literal("user_info").describe("The type of the response."),
|
|
8341
8361
|
userId: p.string().describe("The user ID."),
|
|
8342
8362
|
fullName: p.string().describe("The full name of the user."),
|
|
@@ -8357,22 +8377,22 @@ var Cp = {}, wp = {
|
|
|
8357
8377
|
"Todoist Business"
|
|
8358
8378
|
]).describe("The user plan.")
|
|
8359
8379
|
};
|
|
8360
|
-
function
|
|
8380
|
+
function Dp(e) {
|
|
8361
8381
|
return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
|
|
8362
8382
|
}
|
|
8363
|
-
function
|
|
8383
|
+
function Op(e, t) {
|
|
8364
8384
|
let n = ((e.getDay() || 7) - t + 7) % 7, r = new Date(e);
|
|
8365
8385
|
return r.setDate(e.getDate() - n), r;
|
|
8366
8386
|
}
|
|
8367
|
-
function
|
|
8387
|
+
function kp(e) {
|
|
8368
8388
|
let t = new Date(e);
|
|
8369
8389
|
return t.setDate(e.getDate() + 6), t;
|
|
8370
8390
|
}
|
|
8371
|
-
function
|
|
8391
|
+
function Ap(e) {
|
|
8372
8392
|
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
8393
|
return Math.floor(r / 7) + 1;
|
|
8374
8394
|
}
|
|
8375
|
-
function
|
|
8395
|
+
function jp(e) {
|
|
8376
8396
|
return [
|
|
8377
8397
|
"Sunday",
|
|
8378
8398
|
"Monday",
|
|
@@ -8383,18 +8403,18 @@ function kp(e) {
|
|
|
8383
8403
|
"Saturday"
|
|
8384
8404
|
][e === 7 ? 0 : e] ?? "Unknown";
|
|
8385
8405
|
}
|
|
8386
|
-
function
|
|
8406
|
+
function Mp(e) {
|
|
8387
8407
|
try {
|
|
8388
8408
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
8389
8409
|
} catch {
|
|
8390
8410
|
return !1;
|
|
8391
8411
|
}
|
|
8392
8412
|
}
|
|
8393
|
-
function
|
|
8394
|
-
return
|
|
8413
|
+
function Np(e) {
|
|
8414
|
+
return Mp(e) ? e : "UTC";
|
|
8395
8415
|
}
|
|
8396
|
-
function
|
|
8397
|
-
let n =
|
|
8416
|
+
function Pp(e, t) {
|
|
8417
|
+
let n = Np(t);
|
|
8398
8418
|
return e.toLocaleString("en-US", {
|
|
8399
8419
|
timeZone: n,
|
|
8400
8420
|
year: "numeric",
|
|
@@ -8406,8 +8426,8 @@ function Mp(e, t) {
|
|
|
8406
8426
|
hour12: !1
|
|
8407
8427
|
});
|
|
8408
8428
|
}
|
|
8409
|
-
async function
|
|
8410
|
-
let t = await e.getUser(), n =
|
|
8429
|
+
async function Fp(e) {
|
|
8430
|
+
let t = await e.getUser(), n = Np(t.tzInfo?.timezone ?? "UTC"), r = /* @__PURE__ */ new Date(), i = Pp(r, n), a = t.startDay ?? 1, o = jp(a), s = Dp(t), c = Op(new Date(r.toLocaleString("en-US", { timeZone: n })), a), l = kp(c), u = Ap(c);
|
|
8411
8431
|
return {
|
|
8412
8432
|
textContent: [
|
|
8413
8433
|
"# User Information",
|
|
@@ -8451,30 +8471,30 @@ async function Np(e) {
|
|
|
8451
8471
|
}
|
|
8452
8472
|
};
|
|
8453
8473
|
}
|
|
8454
|
-
var
|
|
8474
|
+
var Ip = {
|
|
8455
8475
|
name: B.USER_INFO,
|
|
8456
8476
|
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:
|
|
8477
|
+
parameters: Tp,
|
|
8478
|
+
outputSchema: Ep,
|
|
8459
8479
|
annotations: {
|
|
8460
8480
|
readOnlyHint: !0,
|
|
8461
8481
|
destructiveHint: !1,
|
|
8462
8482
|
idempotentHint: !0
|
|
8463
8483
|
},
|
|
8464
8484
|
async execute(e, t) {
|
|
8465
|
-
let n = await
|
|
8485
|
+
let n = await Fp(t);
|
|
8466
8486
|
return {
|
|
8467
8487
|
textContent: n.textContent,
|
|
8468
8488
|
structuredContent: n.structuredContent
|
|
8469
8489
|
};
|
|
8470
8490
|
}
|
|
8471
|
-
},
|
|
8491
|
+
}, Lp = 10485760, Rp = /* @__PURE__ */ new Set([
|
|
8472
8492
|
"image/png",
|
|
8473
8493
|
"image/jpeg",
|
|
8474
8494
|
"image/gif",
|
|
8475
8495
|
"image/webp",
|
|
8476
8496
|
"image/svg+xml"
|
|
8477
|
-
]),
|
|
8497
|
+
]), zp = /* @__PURE__ */ new Set([
|
|
8478
8498
|
"text/plain",
|
|
8479
8499
|
"text/csv",
|
|
8480
8500
|
"text/html",
|
|
@@ -8482,7 +8502,7 @@ var Pp = {
|
|
|
8482
8502
|
"application/json",
|
|
8483
8503
|
"application/xml",
|
|
8484
8504
|
"text/xml"
|
|
8485
|
-
]),
|
|
8505
|
+
]), Bp = {
|
|
8486
8506
|
".png": "image/png",
|
|
8487
8507
|
".jpg": "image/jpeg",
|
|
8488
8508
|
".jpeg": "image/jpeg",
|
|
@@ -8497,21 +8517,21 @@ var Pp = {
|
|
|
8497
8517
|
".xml": "application/xml",
|
|
8498
8518
|
".pdf": "application/pdf"
|
|
8499
8519
|
};
|
|
8500
|
-
function
|
|
8501
|
-
return
|
|
8520
|
+
function Vp(e) {
|
|
8521
|
+
return Rp.has(e) ? "image" : zp.has(e) || e.startsWith("text/") ? "text" : "binary";
|
|
8502
8522
|
}
|
|
8503
|
-
function
|
|
8523
|
+
function Hp(e) {
|
|
8504
8524
|
return (e.split(";")[0] ?? e).trim().toLowerCase();
|
|
8505
8525
|
}
|
|
8506
|
-
function
|
|
8526
|
+
function Up(e) {
|
|
8507
8527
|
try {
|
|
8508
8528
|
let t = new URL(e).pathname, n = t.lastIndexOf(".");
|
|
8509
|
-
return n === -1 ? void 0 :
|
|
8529
|
+
return n === -1 ? void 0 : Bp[t.slice(n).toLowerCase()];
|
|
8510
8530
|
} catch {
|
|
8511
8531
|
return;
|
|
8512
8532
|
}
|
|
8513
8533
|
}
|
|
8514
|
-
function
|
|
8534
|
+
function Wp(e) {
|
|
8515
8535
|
try {
|
|
8516
8536
|
let t = new URL(e).pathname, n = t.lastIndexOf("/");
|
|
8517
8537
|
return n === -1 ? void 0 : t.slice(n + 1) || void 0;
|
|
@@ -8519,21 +8539,21 @@ function Hp(e) {
|
|
|
8519
8539
|
return;
|
|
8520
8540
|
}
|
|
8521
8541
|
}
|
|
8522
|
-
var
|
|
8542
|
+
var Gp = { 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.") }, Kp = {
|
|
8523
8543
|
name: B.VIEW_ATTACHMENT,
|
|
8524
8544
|
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:
|
|
8545
|
+
parameters: Gp,
|
|
8526
8546
|
annotations: {
|
|
8527
8547
|
readOnlyHint: !0,
|
|
8528
8548
|
destructiveHint: !1,
|
|
8529
8549
|
idempotentHint: !0
|
|
8530
8550
|
},
|
|
8531
8551
|
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 >
|
|
8552
|
+
let n = await t.viewAttachment(e), r = n.headers["content-length"], i = r ? Number.parseInt(r, 10) : void 0, a = Wp(e), o = n.headers["content-type"], s = o ? Hp(o) : void 0, c = s && s !== "application/octet-stream" ? s : Up(e) ?? s ?? "application/octet-stream";
|
|
8553
|
+
if (i && i > Lp) return { textContent: `Attachment "${a ?? e}" is too large to display inline (${(i / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${c}` };
|
|
8534
8554
|
let l = Buffer.from(await n.arrayBuffer()), u = l.byteLength;
|
|
8535
|
-
if (u >
|
|
8536
|
-
let d =
|
|
8555
|
+
if (u > Lp) return { textContent: `Attachment "${a ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${c}` };
|
|
8556
|
+
let d = Vp(c), f = [];
|
|
8537
8557
|
return d === "image" ? f.push({
|
|
8538
8558
|
type: "image",
|
|
8539
8559
|
data: l.toString("base64"),
|
|
@@ -8553,77 +8573,77 @@ var Up = { fileUrl: p.url().regex(/^https:\/\/(?:files\.todoist\.com|todoist\.b-
|
|
|
8553
8573
|
contentItems: f
|
|
8554
8574
|
};
|
|
8555
8575
|
}
|
|
8556
|
-
},
|
|
8576
|
+
}, qp = {
|
|
8557
8577
|
addTasks: xo,
|
|
8558
|
-
completeTasks:
|
|
8559
|
-
uncompleteTasks:
|
|
8560
|
-
updateTasks:
|
|
8561
|
-
rescheduleTasks:
|
|
8562
|
-
findTasks:
|
|
8578
|
+
completeTasks: is,
|
|
8579
|
+
uncompleteTasks: Xd,
|
|
8580
|
+
updateTasks: cp,
|
|
8581
|
+
rescheduleTasks: Od,
|
|
8582
|
+
findTasks: Nl,
|
|
8563
8583
|
findTasksByDate: {
|
|
8564
|
-
...
|
|
8584
|
+
...bl,
|
|
8565
8585
|
_meta: { ui: { resourceUri: ke } }
|
|
8566
8586
|
},
|
|
8567
|
-
findCompletedTasks:
|
|
8587
|
+
findCompletedTasks: vc,
|
|
8568
8588
|
addProjects: Pa,
|
|
8569
|
-
updateProjects:
|
|
8570
|
-
findProjects:
|
|
8571
|
-
projectManagement:
|
|
8572
|
-
projectMove:
|
|
8589
|
+
updateProjects: Af,
|
|
8590
|
+
findProjects: Xc,
|
|
8591
|
+
projectManagement: Qu,
|
|
8592
|
+
projectMove: nd,
|
|
8573
8593
|
addFolders: pa,
|
|
8574
|
-
updateFolders:
|
|
8575
|
-
findFolders:
|
|
8594
|
+
updateFolders: hf,
|
|
8595
|
+
findFolders: Ec,
|
|
8576
8596
|
addSections: po,
|
|
8577
|
-
updateSections:
|
|
8578
|
-
findSections:
|
|
8597
|
+
updateSections: Uf,
|
|
8598
|
+
findSections: dl,
|
|
8579
8599
|
addComments: Ui,
|
|
8580
|
-
findComments:
|
|
8581
|
-
updateComments:
|
|
8600
|
+
findComments: ac,
|
|
8601
|
+
updateComments: nf,
|
|
8582
8602
|
addReminders: so,
|
|
8583
|
-
findReminders:
|
|
8584
|
-
updateReminders:
|
|
8585
|
-
viewAttachment:
|
|
8603
|
+
findReminders: il,
|
|
8604
|
+
updateReminders: zf,
|
|
8605
|
+
viewAttachment: Kp,
|
|
8586
8606
|
addLabels: va,
|
|
8587
|
-
updateLabels:
|
|
8588
|
-
findLabels:
|
|
8607
|
+
updateLabels: Cf,
|
|
8608
|
+
findLabels: jc,
|
|
8589
8609
|
findFilters: Qi,
|
|
8590
8610
|
addFilters: ra,
|
|
8591
|
-
updateFilters:
|
|
8592
|
-
findActivity:
|
|
8593
|
-
getProductivityStats:
|
|
8594
|
-
getProjectHealth:
|
|
8595
|
-
getProjectActivityStats:
|
|
8596
|
-
analyzeProjectHealth:
|
|
8597
|
-
getWorkspaceInsights:
|
|
8598
|
-
getOverview:
|
|
8599
|
-
deleteObject:
|
|
8600
|
-
fetchObject:
|
|
8601
|
-
reorderObjects:
|
|
8602
|
-
userInfo:
|
|
8603
|
-
getUserStatus:
|
|
8604
|
-
setUserStatus:
|
|
8605
|
-
findProjectCollaborators:
|
|
8606
|
-
manageAssignments:
|
|
8607
|
-
exportProject:
|
|
8608
|
-
importIntoProject:
|
|
8609
|
-
addTemplate:
|
|
8610
|
-
findTemplates:
|
|
8611
|
-
updateTemplate:
|
|
8612
|
-
listWorkspaces:
|
|
8613
|
-
search:
|
|
8614
|
-
fetch:
|
|
8615
|
-
},
|
|
8616
|
-
function
|
|
8611
|
+
updateFilters: cf,
|
|
8612
|
+
findActivity: Js,
|
|
8613
|
+
getProductivityStats: cu,
|
|
8614
|
+
getProjectHealth: _u,
|
|
8615
|
+
getProjectActivityStats: pu,
|
|
8616
|
+
analyzeProjectHealth: ts,
|
|
8617
|
+
getWorkspaceInsights: Ou,
|
|
8618
|
+
getOverview: ru,
|
|
8619
|
+
deleteObject: xs,
|
|
8620
|
+
fetchObject: zs,
|
|
8621
|
+
reorderObjects: md,
|
|
8622
|
+
userInfo: Ip,
|
|
8623
|
+
getUserStatus: wu,
|
|
8624
|
+
setUserStatus: qd,
|
|
8625
|
+
findProjectCollaborators: Rc,
|
|
8626
|
+
manageAssignments: Ku,
|
|
8627
|
+
exportProject: Es,
|
|
8628
|
+
importIntoProject: Pu,
|
|
8629
|
+
addTemplate: Jo,
|
|
8630
|
+
findTemplates: Vl,
|
|
8631
|
+
updateTemplate: Cp,
|
|
8632
|
+
listWorkspaces: zu,
|
|
8633
|
+
search: Id,
|
|
8634
|
+
fetch: Us
|
|
8635
|
+
}, Jp = Object.values(qp), Yp = "\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", Xp = "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.";
|
|
8636
|
+
function Zp({ token: e, baseUrl: n, features: r = [] }) {
|
|
8617
8637
|
let i = new t({
|
|
8618
8638
|
name: "todoist-mcp-server",
|
|
8619
8639
|
version: zt,
|
|
8620
|
-
description:
|
|
8640
|
+
description: Xp
|
|
8621
8641
|
}, {
|
|
8622
8642
|
capabilities: {
|
|
8623
8643
|
tools: { listChanged: !0 },
|
|
8624
8644
|
prompts: { listChanged: !0 }
|
|
8625
8645
|
},
|
|
8626
|
-
instructions:
|
|
8646
|
+
instructions: Yp,
|
|
8627
8647
|
cacheHints: {
|
|
8628
8648
|
"server/discover": ye,
|
|
8629
8649
|
"tools/list": ye,
|
|
@@ -8633,7 +8653,7 @@ function Yp({ token: e, baseUrl: n, features: r = [] }) {
|
|
|
8633
8653
|
}
|
|
8634
8654
|
}), a = rn(e, { baseUrl: n });
|
|
8635
8655
|
return Ie(i), On({
|
|
8636
|
-
tools:
|
|
8656
|
+
tools: Jp,
|
|
8637
8657
|
server: i,
|
|
8638
8658
|
client: a,
|
|
8639
8659
|
features: r
|
|
@@ -8643,4 +8663,4 @@ function Yp({ token: e, baseUrl: n, features: r = [] }) {
|
|
|
8643
8663
|
argsSchema: Jn.argsSchema
|
|
8644
8664
|
}, (e) => Jn.callback(e, a)), i;
|
|
8645
8665
|
}
|
|
8646
|
-
export { Pa as $,
|
|
8666
|
+
export { Pa as $, ru as A, vc as B, zu as C, _u as D, wu as E, il as F, Es as G, Js as H, Xc as I, ts as J, xs as K, Rc as L, Nl as M, bl as N, pu as O, dl as P, so as Q, jc as R, Ku as S, Ou as T, Us as U, ac as V, zs as W, xo as X, Jo as Y, po as Z, Id as _, Ip as a, yn as at, nd as b, Uf as c, Cf as d, va as et, hf as f, qd as g, Xd as h, Kp as i, Ui as it, Vl as j, cu as k, zf as l, nf as m, Jp as n, ra as nt, Cp as o, qt as ot, cf as p, is as q, qp as r, Qi as rt, cp as s, en as st, Zp as t, pa as tt, Af as u, Od as v, Pu as w, Qu as x, md as y, Ec as z };
|