@sideboard-ai/core 0.1.190 → 0.1.191
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/{abletime-J3EGHIAV.js → abletime-53T7G667.js} +3 -1
- package/dist/{abletime-CAFQ4GEG.js → abletime-JFMBCSIQ.js} +3 -1
- package/dist/{chunk-TEJU6UJY.js → chunk-4M2AK3O5.js} +126 -20
- package/dist/{chunk-Z6TW3A5P.js → chunk-5RRAKGPK.js} +6 -6
- package/dist/{chunk-IAOXW6RI.js → chunk-GPSIZGEZ.js} +6 -6
- package/dist/{chunk-KEVY4GEK.js → chunk-UBQIELFS.js} +123 -20
- package/dist/index.cjs +507 -46
- package/dist/index.d.cts +88 -3
- package/dist/index.d.ts +88 -3
- package/dist/index.js +376 -24
- package/dist/mcp/run-stdio.cjs +487 -46
- package/dist/mcp/run-stdio.js +362 -24
- package/dist/{orchestrator-BHJELEFM.js → orchestrator-2X6LYBQI.js} +1 -1
- package/dist/{orchestrator-HWNGCDGW.js → orchestrator-F3CXDBZB.js} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
ableTimeDependencyTarget,
|
|
4
5
|
commentAbleTimeTask,
|
|
5
6
|
createAbleTimeTask,
|
|
6
7
|
ensureAbleTimeTask,
|
|
@@ -16,13 +17,14 @@ import {
|
|
|
16
17
|
toAbleTimeIssueInfo,
|
|
17
18
|
updateAbleTimeTask,
|
|
18
19
|
verifyAbleTimeConnection
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-UBQIELFS.js";
|
|
20
21
|
import "./chunk-VKQGAWHY.js";
|
|
21
22
|
import "./chunk-OKZFTOM2.js";
|
|
22
23
|
import "./chunk-NSTQ6QKD.js";
|
|
23
24
|
import "./chunk-KGZBYWZ3.js";
|
|
24
25
|
import "./chunk-JTJHOYCU.js";
|
|
25
26
|
export {
|
|
27
|
+
ableTimeDependencyTarget,
|
|
26
28
|
commentAbleTimeTask,
|
|
27
29
|
createAbleTimeTask,
|
|
28
30
|
ensureAbleTimeTask,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ableTimeDependencyTarget,
|
|
2
3
|
commentAbleTimeTask,
|
|
3
4
|
createAbleTimeTask,
|
|
4
5
|
ensureAbleTimeTask,
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
toAbleTimeIssueInfo,
|
|
15
16
|
updateAbleTimeTask,
|
|
16
17
|
verifyAbleTimeConnection
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4M2AK3O5.js";
|
|
18
19
|
import "./chunk-N7WZ6NIN.js";
|
|
19
20
|
import "./chunk-J7LQVLFQ.js";
|
|
20
21
|
import "./chunk-4TR3HZFT.js";
|
|
@@ -22,6 +23,7 @@ import "./chunk-JT7R45JB.js";
|
|
|
22
23
|
import "./chunk-77WWLBCI.js";
|
|
23
24
|
import "./chunk-EFVFB2AH.js";
|
|
24
25
|
export {
|
|
26
|
+
ableTimeDependencyTarget,
|
|
25
27
|
commentAbleTimeTask,
|
|
26
28
|
createAbleTimeTask,
|
|
27
29
|
ensureAbleTimeTask,
|
|
@@ -11,14 +11,31 @@ import {
|
|
|
11
11
|
// src/integrations/abletime-mcp.ts
|
|
12
12
|
var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
|
|
13
13
|
var ABLETIME_MCP_PATH = "/api/public/v2/mcp";
|
|
14
|
+
var ABLETIME_MCP_PM_PATH = "/api/public/v2/mcp/pm";
|
|
14
15
|
var MCP_PROTOCOL_VERSION = "2025-03-26";
|
|
16
|
+
var ABLETIME_PM_TOOL_NAMES = [
|
|
17
|
+
"set_task_assignee",
|
|
18
|
+
"set_task_priority",
|
|
19
|
+
"set_task_stage",
|
|
20
|
+
"set_task_dependency",
|
|
21
|
+
"set_task_blocked",
|
|
22
|
+
"set_task_locked",
|
|
23
|
+
"set_task_schedule",
|
|
24
|
+
"clear_task_schedule",
|
|
25
|
+
"archive_task",
|
|
26
|
+
"delete_task"
|
|
27
|
+
];
|
|
28
|
+
function abletimeToolUsesPm(name) {
|
|
29
|
+
return ABLETIME_PM_TOOL_NAMES.includes(name);
|
|
30
|
+
}
|
|
15
31
|
function normalizeAbleTimeHost(raw) {
|
|
16
32
|
const trimmed = raw?.trim() || DEFAULT_ABLETIME_HOST;
|
|
17
33
|
const withScheme = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
18
34
|
return withScheme.replace(/\/+$/, "");
|
|
19
35
|
}
|
|
20
|
-
function abletimeMcpUrl(host) {
|
|
21
|
-
|
|
36
|
+
function abletimeMcpUrl(host, opts) {
|
|
37
|
+
const path = opts?.pm ? ABLETIME_MCP_PM_PATH : ABLETIME_MCP_PATH;
|
|
38
|
+
return `${normalizeAbleTimeHost(host)}${path}`;
|
|
22
39
|
}
|
|
23
40
|
function rewriteAbleTimeError(message) {
|
|
24
41
|
if (/INTEGRATION_AGENT_ACCESS_DISABLED|agent access/i.test(message)) {
|
|
@@ -96,7 +113,8 @@ async function abletimeMcpRequest(method, params, opts) {
|
|
|
96
113
|
throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
|
|
97
114
|
}
|
|
98
115
|
const url = abletimeMcpUrl(
|
|
99
|
-
opts?.host ?? (opts?.token ? DEFAULT_ABLETIME_HOST : getAbleTimeHost())
|
|
116
|
+
opts?.host ?? (opts?.token ? DEFAULT_ABLETIME_HOST : getAbleTimeHost()),
|
|
117
|
+
{ pm: opts?.pm }
|
|
100
118
|
);
|
|
101
119
|
const res = await httpFetch(url, {
|
|
102
120
|
method: "POST",
|
|
@@ -160,7 +178,8 @@ async function callAbleTimeTool(name, args = {}, opts) {
|
|
|
160
178
|
if (!opts?.token && !isAbleTimeConnected()) {
|
|
161
179
|
throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
|
|
162
180
|
}
|
|
163
|
-
const
|
|
181
|
+
const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
|
|
182
|
+
const call = () => abletimeMcpRequest("tools/call", { name, arguments: args }, requestOpts).then((result) => {
|
|
164
183
|
return unwrapToolResult(result);
|
|
165
184
|
});
|
|
166
185
|
try {
|
|
@@ -168,7 +187,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
|
|
|
168
187
|
} catch (err) {
|
|
169
188
|
const message = err instanceof Error ? err.message : String(err);
|
|
170
189
|
if (/initialize|session|not initialized|-32000/i.test(message)) {
|
|
171
|
-
await initializeIfNeeded(
|
|
190
|
+
await initializeIfNeeded(requestOpts);
|
|
172
191
|
return await call();
|
|
173
192
|
}
|
|
174
193
|
throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
|
|
@@ -424,39 +443,122 @@ async function commentAbleTimeTask(input, opts) {
|
|
|
424
443
|
body: rec ? firstString(rec, ["body", "text", "comment"]) || body : body
|
|
425
444
|
};
|
|
426
445
|
}
|
|
446
|
+
function isAbleTimeNoneToken(value) {
|
|
447
|
+
if (value == null) return true;
|
|
448
|
+
const s = value.trim();
|
|
449
|
+
return !s || /^(none|clear|unschedule|null)$/i.test(s);
|
|
450
|
+
}
|
|
451
|
+
function taskIdArgs(id) {
|
|
452
|
+
return { id, task_id: id, task: id };
|
|
453
|
+
}
|
|
454
|
+
function ableTimeDependencyTarget(thisId, type, relatedId) {
|
|
455
|
+
const s = type.trim().toLowerCase().replace(/[\s_-]+/g, "");
|
|
456
|
+
if (s === "none" || s === "clear" || s === "null") {
|
|
457
|
+
return { taskId: thisId, dependsOn: null };
|
|
458
|
+
}
|
|
459
|
+
if (s === "blockedby" || s === "blocked" || s === "dependson" || s === "waiton") {
|
|
460
|
+
return { taskId: thisId, dependsOn: relatedId };
|
|
461
|
+
}
|
|
462
|
+
if (s === "blocks" || s === "blocking") {
|
|
463
|
+
return { taskId: relatedId, dependsOn: thisId };
|
|
464
|
+
}
|
|
465
|
+
throw new Error(
|
|
466
|
+
`AbleTime relation type must be blocks or blockedBy (got ${type}). AbleTime models one wait-on dependency.`
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
async function setAbleTimeTaskDependency(taskId, dependsOn, opts) {
|
|
470
|
+
const args = {
|
|
471
|
+
...taskIdArgs(taskId)
|
|
472
|
+
};
|
|
473
|
+
if (dependsOn) {
|
|
474
|
+
args.depends_on = dependsOn;
|
|
475
|
+
args.depends_on_id = dependsOn;
|
|
476
|
+
args.dependency = dependsOn;
|
|
477
|
+
args.dependency_id = dependsOn;
|
|
478
|
+
args.blocked_by = dependsOn;
|
|
479
|
+
args.wait_on = dependsOn;
|
|
480
|
+
args.related_task_id = dependsOn;
|
|
481
|
+
} else {
|
|
482
|
+
args.depends_on = null;
|
|
483
|
+
args.dependency = null;
|
|
484
|
+
args.blocked_by = null;
|
|
485
|
+
args.clear = true;
|
|
486
|
+
}
|
|
487
|
+
await callAbleTimeTool("set_task_dependency", args, opts);
|
|
488
|
+
}
|
|
427
489
|
async function updateAbleTimeTask(input, opts) {
|
|
428
490
|
const id = input.id.trim();
|
|
429
491
|
if (!id) throw new Error("AbleTime task id is required");
|
|
430
492
|
const title = input.title?.trim();
|
|
431
493
|
const description = input.description;
|
|
432
494
|
const state = input.state?.trim();
|
|
433
|
-
|
|
434
|
-
|
|
495
|
+
const addRelations = input.relations?.length ? input.relations : void 0;
|
|
496
|
+
const removeRelations = input.removeRelations?.length ? input.removeRelations : void 0;
|
|
497
|
+
const updateArgs = { ...taskIdArgs(id) };
|
|
498
|
+
if (title) updateArgs.title = title;
|
|
499
|
+
if (description !== void 0) updateArgs.description = description;
|
|
500
|
+
if (input.labels !== void 0) {
|
|
501
|
+
updateArgs.tags = input.labels;
|
|
502
|
+
updateArgs.labels = input.labels;
|
|
503
|
+
updateArgs.tag_names = input.labels;
|
|
504
|
+
}
|
|
505
|
+
if (input.project !== void 0) {
|
|
506
|
+
const projectName = (input.project ?? "").trim();
|
|
507
|
+
if (isAbleTimeNoneToken(projectName)) {
|
|
508
|
+
throw new Error("AbleTime tasks stay in a project \u2014 pass a project name or id");
|
|
509
|
+
}
|
|
510
|
+
const project = await resolveAbleTimeProject(projectName, opts);
|
|
511
|
+
updateArgs.project = project.id;
|
|
512
|
+
updateArgs.project_id = project.id;
|
|
513
|
+
}
|
|
514
|
+
if (input.parent !== void 0) {
|
|
515
|
+
if (isAbleTimeNoneToken(input.parent)) {
|
|
516
|
+
updateArgs.parent = null;
|
|
517
|
+
updateArgs.parent_id = null;
|
|
518
|
+
updateArgs.related_task_id = null;
|
|
519
|
+
} else {
|
|
520
|
+
const parent = (input.parent ?? "").trim();
|
|
521
|
+
updateArgs.parent = parent;
|
|
522
|
+
updateArgs.parent_id = parent;
|
|
523
|
+
updateArgs.related_task_id = parent;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const hasUpdateFields = Boolean(title) || description !== void 0 || input.labels !== void 0 || input.project !== void 0 || input.parent !== void 0;
|
|
527
|
+
if (!hasUpdateFields && !state && !addRelations && !removeRelations) {
|
|
528
|
+
throw new Error(
|
|
529
|
+
"abletime_update_task needs at least one of title, description, state, labels, project, parent, relations, removeRelations"
|
|
530
|
+
);
|
|
435
531
|
}
|
|
436
532
|
if (state) {
|
|
437
533
|
await callAbleTimeTool(
|
|
438
534
|
"set_task_state",
|
|
439
|
-
{ id,
|
|
535
|
+
{ ...taskIdArgs(id), state },
|
|
440
536
|
opts
|
|
441
537
|
).catch(async () => {
|
|
442
538
|
await callAbleTimeTool(
|
|
443
539
|
"update_task",
|
|
444
|
-
{
|
|
540
|
+
{ ...updateArgs, state },
|
|
445
541
|
opts
|
|
446
542
|
);
|
|
447
543
|
});
|
|
448
544
|
}
|
|
449
|
-
if (
|
|
450
|
-
await callAbleTimeTool(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
);
|
|
545
|
+
if (hasUpdateFields) {
|
|
546
|
+
await callAbleTimeTool("update_task", updateArgs, opts);
|
|
547
|
+
}
|
|
548
|
+
for (const rel of removeRelations ?? []) {
|
|
549
|
+
const related = rel.issue.trim() || id;
|
|
550
|
+
const target = ableTimeDependencyTarget(id, rel.type, related);
|
|
551
|
+
await setAbleTimeTaskDependency(target.taskId, null, opts);
|
|
552
|
+
}
|
|
553
|
+
for (const rel of addRelations ?? []) {
|
|
554
|
+
const related = rel.issue.trim();
|
|
555
|
+
if (!related) throw new Error("AbleTime relations.issue is required (id or CRM-232)");
|
|
556
|
+
const target = ableTimeDependencyTarget(id, rel.type, related);
|
|
557
|
+
if (!target.dependsOn) {
|
|
558
|
+
await setAbleTimeTaskDependency(target.taskId, null, opts);
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
await setAbleTimeTaskDependency(target.taskId, target.dependsOn, opts);
|
|
460
562
|
}
|
|
461
563
|
return getAbleTimeTask(id, opts);
|
|
462
564
|
}
|
|
@@ -540,6 +642,9 @@ async function verifyAbleTimeConnection(input) {
|
|
|
540
642
|
export {
|
|
541
643
|
DEFAULT_ABLETIME_HOST,
|
|
542
644
|
ABLETIME_MCP_PATH,
|
|
645
|
+
ABLETIME_MCP_PM_PATH,
|
|
646
|
+
ABLETIME_PM_TOOL_NAMES,
|
|
647
|
+
abletimeToolUsesPm,
|
|
543
648
|
normalizeAbleTimeHost,
|
|
544
649
|
abletimeMcpUrl,
|
|
545
650
|
rewriteAbleTimeError,
|
|
@@ -556,6 +661,7 @@ export {
|
|
|
556
661
|
getAbleTimeTask,
|
|
557
662
|
createAbleTimeTask,
|
|
558
663
|
commentAbleTimeTask,
|
|
664
|
+
ableTimeDependencyTarget,
|
|
559
665
|
updateAbleTimeTask,
|
|
560
666
|
ensureAbleTimeTask,
|
|
561
667
|
listAbleTimeAssignedIssues,
|
|
@@ -467,7 +467,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
467
467
|
await continueOnReply(threadId, prompt);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
470
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-F3CXDBZB.js");
|
|
471
471
|
await getOrchestrator2().send(threadId, prompt);
|
|
472
472
|
} catch {
|
|
473
473
|
}
|
|
@@ -3772,7 +3772,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3772
3772
|
let sourceIsFork = false;
|
|
3773
3773
|
if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
|
|
3774
3774
|
if (isAbleTimeConnected() && getIssueSource() === "abletime") {
|
|
3775
|
-
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-
|
|
3775
|
+
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-JFMBCSIQ.js");
|
|
3776
3776
|
const task = await ensureAbleTimeTask({
|
|
3777
3777
|
title: title?.trim() || "Untitled work",
|
|
3778
3778
|
description: input.prompt?.trim() || void 0
|
|
@@ -6130,17 +6130,17 @@ function formatIssueToolsDirective(opts) {
|
|
|
6130
6130
|
];
|
|
6131
6131
|
if (opts.linear) {
|
|
6132
6132
|
lines.push(
|
|
6133
|
-
"- Linear: `linear_search_issues` (assignee=me; pass `updatedSince` for \u201Cany updates since yesterday?\u201D \u2014 new tickets, edits, and comments), `linear_get_issue` (comments; pass `include=full` if crush.truncated), `linear_comment`, `linear_update_issue` (state, cycle), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
|
|
6133
|
+
"- Linear: `linear_search_issues` (assignee=me; pass `updatedSince` for \u201Cany updates since yesterday?\u201D \u2014 new tickets, edits, and comments), `linear_get_issue` (comments; pass `include=full` if crush.truncated), `linear_comment`, `linear_update_issue` (state, cycle, labels, project, parent, relations), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
|
|
6134
6134
|
);
|
|
6135
6135
|
}
|
|
6136
6136
|
if (github) {
|
|
6137
6137
|
lines.push(
|
|
6138
|
-
"- GitHub: `github_search_issues` (assignee=me; `updatedSince` for inbox updates + comments), `github_get_issue` (comments; pass `include=full` if crush.truncated), `github_comment`, `github_update_issue` (state open|closed), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
|
|
6138
|
+
"- GitHub: `github_search_issues` (assignee=me; `updatedSince` for inbox updates + comments), `github_get_issue` (comments; pass `include=full` if crush.truncated), `github_comment`, `github_update_issue` (state open|closed, labels, project, parent, relations), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
|
|
6139
6139
|
);
|
|
6140
6140
|
}
|
|
6141
6141
|
if (opts.abletime) {
|
|
6142
6142
|
lines.push(
|
|
6143
|
-
"- AbleTime: `abletime_list_tasks` / `abletime_search_tasks` (`updatedSince` for inbox updates + comments), `abletime_get_task` (comments; pass `include=full` if crush.truncated), `abletime_comment`, `abletime_update_task` (state), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
|
|
6143
|
+
"- AbleTime: `abletime_list_tasks` / `abletime_search_tasks` (`updatedSince` for inbox updates + comments), `abletime_get_task` (comments; pass `include=full` if crush.truncated), `abletime_comment`, `abletime_update_task` (state, labels, project, parent, relations), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
|
|
6144
6144
|
);
|
|
6145
6145
|
}
|
|
6146
6146
|
lines.push(
|
|
@@ -6805,7 +6805,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
6805
6805
|
${prompt}`;
|
|
6806
6806
|
}
|
|
6807
6807
|
async function defaultDeps() {
|
|
6808
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
6808
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-F3CXDBZB.js");
|
|
6809
6809
|
const orch = getOrchestrator2();
|
|
6810
6810
|
return {
|
|
6811
6811
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -402,7 +402,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
402
402
|
await continueOnReply(threadId, prompt);
|
|
403
403
|
return;
|
|
404
404
|
}
|
|
405
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
405
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-2X6LYBQI.js");
|
|
406
406
|
await getOrchestrator2().send(threadId, prompt);
|
|
407
407
|
} catch {
|
|
408
408
|
}
|
|
@@ -3643,7 +3643,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3643
3643
|
let sourceIsFork = false;
|
|
3644
3644
|
if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
|
|
3645
3645
|
if (isAbleTimeConnected() && getIssueSource() === "abletime") {
|
|
3646
|
-
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-
|
|
3646
|
+
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-53T7G667.js");
|
|
3647
3647
|
const task = await ensureAbleTimeTask({
|
|
3648
3648
|
title: title?.trim() || "Untitled work",
|
|
3649
3649
|
description: input.prompt?.trim() || void 0
|
|
@@ -5972,17 +5972,17 @@ function formatIssueToolsDirective(opts) {
|
|
|
5972
5972
|
];
|
|
5973
5973
|
if (opts.linear) {
|
|
5974
5974
|
lines.push(
|
|
5975
|
-
"- Linear: `linear_search_issues` (assignee=me; pass `updatedSince` for \u201Cany updates since yesterday?\u201D \u2014 new tickets, edits, and comments), `linear_get_issue` (comments; pass `include=full` if crush.truncated), `linear_comment`, `linear_update_issue` (state, cycle), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
|
|
5975
|
+
"- Linear: `linear_search_issues` (assignee=me; pass `updatedSince` for \u201Cany updates since yesterday?\u201D \u2014 new tickets, edits, and comments), `linear_get_issue` (comments; pass `include=full` if crush.truncated), `linear_comment`, `linear_update_issue` (state, cycle, labels, project, parent, relations), `linear_create_issue` (pass `parent` for spin-offs; call `linear_list_teams` first). Scope errors: reconnect Linear in Settings \u2192 Issues."
|
|
5976
5976
|
);
|
|
5977
5977
|
}
|
|
5978
5978
|
if (github) {
|
|
5979
5979
|
lines.push(
|
|
5980
|
-
"- GitHub: `github_search_issues` (assignee=me; `updatedSince` for inbox updates + comments), `github_get_issue` (comments; pass `include=full` if crush.truncated), `github_comment`, `github_update_issue` (state open|closed), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
|
|
5980
|
+
"- GitHub: `github_search_issues` (assignee=me; `updatedSince` for inbox updates + comments), `github_get_issue` (comments; pass `include=full` if crush.truncated), `github_comment`, `github_update_issue` (state open|closed, labels, project, parent, relations), `github_create_issue` (pass `parent` for spin-offs). Uses Account `gh`."
|
|
5981
5981
|
);
|
|
5982
5982
|
}
|
|
5983
5983
|
if (opts.abletime) {
|
|
5984
5984
|
lines.push(
|
|
5985
|
-
"- AbleTime: `abletime_list_tasks` / `abletime_search_tasks` (`updatedSince` for inbox updates + comments), `abletime_get_task` (comments; pass `include=full` if crush.truncated), `abletime_comment`, `abletime_update_task` (state), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
|
|
5985
|
+
"- AbleTime: `abletime_list_tasks` / `abletime_search_tasks` (`updatedSince` for inbox updates + comments), `abletime_get_task` (comments; pass `include=full` if crush.truncated), `abletime_comment`, `abletime_update_task` (state, labels, project, parent, relations), `abletime_create_task` (pass `parent` for spin-offs; `abletime_list_projects` if needed)."
|
|
5986
5986
|
);
|
|
5987
5987
|
}
|
|
5988
5988
|
lines.push(
|
|
@@ -6458,7 +6458,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
6458
6458
|
${prompt}`;
|
|
6459
6459
|
}
|
|
6460
6460
|
async function defaultDeps() {
|
|
6461
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
6461
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-2X6LYBQI.js");
|
|
6462
6462
|
const orch = getOrchestrator2();
|
|
6463
6463
|
return {
|
|
6464
6464
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -13,14 +13,31 @@ import {
|
|
|
13
13
|
// src/integrations/abletime-mcp.ts
|
|
14
14
|
var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
|
|
15
15
|
var ABLETIME_MCP_PATH = "/api/public/v2/mcp";
|
|
16
|
+
var ABLETIME_MCP_PM_PATH = "/api/public/v2/mcp/pm";
|
|
16
17
|
var MCP_PROTOCOL_VERSION = "2025-03-26";
|
|
18
|
+
var ABLETIME_PM_TOOL_NAMES = [
|
|
19
|
+
"set_task_assignee",
|
|
20
|
+
"set_task_priority",
|
|
21
|
+
"set_task_stage",
|
|
22
|
+
"set_task_dependency",
|
|
23
|
+
"set_task_blocked",
|
|
24
|
+
"set_task_locked",
|
|
25
|
+
"set_task_schedule",
|
|
26
|
+
"clear_task_schedule",
|
|
27
|
+
"archive_task",
|
|
28
|
+
"delete_task"
|
|
29
|
+
];
|
|
30
|
+
function abletimeToolUsesPm(name) {
|
|
31
|
+
return ABLETIME_PM_TOOL_NAMES.includes(name);
|
|
32
|
+
}
|
|
17
33
|
function normalizeAbleTimeHost(raw) {
|
|
18
34
|
const trimmed = raw?.trim() || DEFAULT_ABLETIME_HOST;
|
|
19
35
|
const withScheme = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
20
36
|
return withScheme.replace(/\/+$/, "");
|
|
21
37
|
}
|
|
22
|
-
function abletimeMcpUrl(host) {
|
|
23
|
-
|
|
38
|
+
function abletimeMcpUrl(host, opts) {
|
|
39
|
+
const path = opts?.pm ? ABLETIME_MCP_PM_PATH : ABLETIME_MCP_PATH;
|
|
40
|
+
return `${normalizeAbleTimeHost(host)}${path}`;
|
|
24
41
|
}
|
|
25
42
|
function rewriteAbleTimeError(message) {
|
|
26
43
|
if (/INTEGRATION_AGENT_ACCESS_DISABLED|agent access/i.test(message)) {
|
|
@@ -98,7 +115,8 @@ async function abletimeMcpRequest(method, params, opts) {
|
|
|
98
115
|
throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
|
|
99
116
|
}
|
|
100
117
|
const url = abletimeMcpUrl(
|
|
101
|
-
opts?.host ?? (opts?.token ? DEFAULT_ABLETIME_HOST : getAbleTimeHost())
|
|
118
|
+
opts?.host ?? (opts?.token ? DEFAULT_ABLETIME_HOST : getAbleTimeHost()),
|
|
119
|
+
{ pm: opts?.pm }
|
|
102
120
|
);
|
|
103
121
|
const res = await httpFetch(url, {
|
|
104
122
|
method: "POST",
|
|
@@ -162,7 +180,8 @@ async function callAbleTimeTool(name, args = {}, opts) {
|
|
|
162
180
|
if (!opts?.token && !isAbleTimeConnected()) {
|
|
163
181
|
throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
|
|
164
182
|
}
|
|
165
|
-
const
|
|
183
|
+
const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
|
|
184
|
+
const call = () => abletimeMcpRequest("tools/call", { name, arguments: args }, requestOpts).then((result) => {
|
|
166
185
|
return unwrapToolResult(result);
|
|
167
186
|
});
|
|
168
187
|
try {
|
|
@@ -170,7 +189,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
|
|
|
170
189
|
} catch (err) {
|
|
171
190
|
const message = err instanceof Error ? err.message : String(err);
|
|
172
191
|
if (/initialize|session|not initialized|-32000/i.test(message)) {
|
|
173
|
-
await initializeIfNeeded(
|
|
192
|
+
await initializeIfNeeded(requestOpts);
|
|
174
193
|
return await call();
|
|
175
194
|
}
|
|
176
195
|
throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
|
|
@@ -426,39 +445,122 @@ async function commentAbleTimeTask(input, opts) {
|
|
|
426
445
|
body: rec ? firstString(rec, ["body", "text", "comment"]) || body : body
|
|
427
446
|
};
|
|
428
447
|
}
|
|
448
|
+
function isAbleTimeNoneToken(value) {
|
|
449
|
+
if (value == null) return true;
|
|
450
|
+
const s = value.trim();
|
|
451
|
+
return !s || /^(none|clear|unschedule|null)$/i.test(s);
|
|
452
|
+
}
|
|
453
|
+
function taskIdArgs(id) {
|
|
454
|
+
return { id, task_id: id, task: id };
|
|
455
|
+
}
|
|
456
|
+
function ableTimeDependencyTarget(thisId, type, relatedId) {
|
|
457
|
+
const s = type.trim().toLowerCase().replace(/[\s_-]+/g, "");
|
|
458
|
+
if (s === "none" || s === "clear" || s === "null") {
|
|
459
|
+
return { taskId: thisId, dependsOn: null };
|
|
460
|
+
}
|
|
461
|
+
if (s === "blockedby" || s === "blocked" || s === "dependson" || s === "waiton") {
|
|
462
|
+
return { taskId: thisId, dependsOn: relatedId };
|
|
463
|
+
}
|
|
464
|
+
if (s === "blocks" || s === "blocking") {
|
|
465
|
+
return { taskId: relatedId, dependsOn: thisId };
|
|
466
|
+
}
|
|
467
|
+
throw new Error(
|
|
468
|
+
`AbleTime relation type must be blocks or blockedBy (got ${type}). AbleTime models one wait-on dependency.`
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
async function setAbleTimeTaskDependency(taskId, dependsOn, opts) {
|
|
472
|
+
const args = {
|
|
473
|
+
...taskIdArgs(taskId)
|
|
474
|
+
};
|
|
475
|
+
if (dependsOn) {
|
|
476
|
+
args.depends_on = dependsOn;
|
|
477
|
+
args.depends_on_id = dependsOn;
|
|
478
|
+
args.dependency = dependsOn;
|
|
479
|
+
args.dependency_id = dependsOn;
|
|
480
|
+
args.blocked_by = dependsOn;
|
|
481
|
+
args.wait_on = dependsOn;
|
|
482
|
+
args.related_task_id = dependsOn;
|
|
483
|
+
} else {
|
|
484
|
+
args.depends_on = null;
|
|
485
|
+
args.dependency = null;
|
|
486
|
+
args.blocked_by = null;
|
|
487
|
+
args.clear = true;
|
|
488
|
+
}
|
|
489
|
+
await callAbleTimeTool("set_task_dependency", args, opts);
|
|
490
|
+
}
|
|
429
491
|
async function updateAbleTimeTask(input, opts) {
|
|
430
492
|
const id = input.id.trim();
|
|
431
493
|
if (!id) throw new Error("AbleTime task id is required");
|
|
432
494
|
const title = input.title?.trim();
|
|
433
495
|
const description = input.description;
|
|
434
496
|
const state = input.state?.trim();
|
|
435
|
-
|
|
436
|
-
|
|
497
|
+
const addRelations = input.relations?.length ? input.relations : void 0;
|
|
498
|
+
const removeRelations = input.removeRelations?.length ? input.removeRelations : void 0;
|
|
499
|
+
const updateArgs = { ...taskIdArgs(id) };
|
|
500
|
+
if (title) updateArgs.title = title;
|
|
501
|
+
if (description !== void 0) updateArgs.description = description;
|
|
502
|
+
if (input.labels !== void 0) {
|
|
503
|
+
updateArgs.tags = input.labels;
|
|
504
|
+
updateArgs.labels = input.labels;
|
|
505
|
+
updateArgs.tag_names = input.labels;
|
|
506
|
+
}
|
|
507
|
+
if (input.project !== void 0) {
|
|
508
|
+
const projectName = (input.project ?? "").trim();
|
|
509
|
+
if (isAbleTimeNoneToken(projectName)) {
|
|
510
|
+
throw new Error("AbleTime tasks stay in a project \u2014 pass a project name or id");
|
|
511
|
+
}
|
|
512
|
+
const project = await resolveAbleTimeProject(projectName, opts);
|
|
513
|
+
updateArgs.project = project.id;
|
|
514
|
+
updateArgs.project_id = project.id;
|
|
515
|
+
}
|
|
516
|
+
if (input.parent !== void 0) {
|
|
517
|
+
if (isAbleTimeNoneToken(input.parent)) {
|
|
518
|
+
updateArgs.parent = null;
|
|
519
|
+
updateArgs.parent_id = null;
|
|
520
|
+
updateArgs.related_task_id = null;
|
|
521
|
+
} else {
|
|
522
|
+
const parent = (input.parent ?? "").trim();
|
|
523
|
+
updateArgs.parent = parent;
|
|
524
|
+
updateArgs.parent_id = parent;
|
|
525
|
+
updateArgs.related_task_id = parent;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const hasUpdateFields = Boolean(title) || description !== void 0 || input.labels !== void 0 || input.project !== void 0 || input.parent !== void 0;
|
|
529
|
+
if (!hasUpdateFields && !state && !addRelations && !removeRelations) {
|
|
530
|
+
throw new Error(
|
|
531
|
+
"abletime_update_task needs at least one of title, description, state, labels, project, parent, relations, removeRelations"
|
|
532
|
+
);
|
|
437
533
|
}
|
|
438
534
|
if (state) {
|
|
439
535
|
await callAbleTimeTool(
|
|
440
536
|
"set_task_state",
|
|
441
|
-
{ id,
|
|
537
|
+
{ ...taskIdArgs(id), state },
|
|
442
538
|
opts
|
|
443
539
|
).catch(async () => {
|
|
444
540
|
await callAbleTimeTool(
|
|
445
541
|
"update_task",
|
|
446
|
-
{
|
|
542
|
+
{ ...updateArgs, state },
|
|
447
543
|
opts
|
|
448
544
|
);
|
|
449
545
|
});
|
|
450
546
|
}
|
|
451
|
-
if (
|
|
452
|
-
await callAbleTimeTool(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
);
|
|
547
|
+
if (hasUpdateFields) {
|
|
548
|
+
await callAbleTimeTool("update_task", updateArgs, opts);
|
|
549
|
+
}
|
|
550
|
+
for (const rel of removeRelations ?? []) {
|
|
551
|
+
const related = rel.issue.trim() || id;
|
|
552
|
+
const target = ableTimeDependencyTarget(id, rel.type, related);
|
|
553
|
+
await setAbleTimeTaskDependency(target.taskId, null, opts);
|
|
554
|
+
}
|
|
555
|
+
for (const rel of addRelations ?? []) {
|
|
556
|
+
const related = rel.issue.trim();
|
|
557
|
+
if (!related) throw new Error("AbleTime relations.issue is required (id or CRM-232)");
|
|
558
|
+
const target = ableTimeDependencyTarget(id, rel.type, related);
|
|
559
|
+
if (!target.dependsOn) {
|
|
560
|
+
await setAbleTimeTaskDependency(target.taskId, null, opts);
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
await setAbleTimeTaskDependency(target.taskId, target.dependsOn, opts);
|
|
462
564
|
}
|
|
463
565
|
return getAbleTimeTask(id, opts);
|
|
464
566
|
}
|
|
@@ -551,6 +653,7 @@ export {
|
|
|
551
653
|
getAbleTimeTask,
|
|
552
654
|
createAbleTimeTask,
|
|
553
655
|
commentAbleTimeTask,
|
|
656
|
+
ableTimeDependencyTarget,
|
|
554
657
|
updateAbleTimeTask,
|
|
555
658
|
ensureAbleTimeTask,
|
|
556
659
|
listAbleTimeAssignedIssues,
|