@dalmasonto/taskflow-mcp 1.0.33 → 2.0.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/README.md +138 -193
- package/dist/attachment-download.d.ts +74 -0
- package/dist/attachment-download.js +193 -0
- package/dist/attachment-download.js.map +1 -0
- package/dist/attachments.d.ts +23 -0
- package/dist/attachments.js +66 -0
- package/dist/attachments.js.map +1 -0
- package/dist/client.d.ts +206 -0
- package/dist/client.js +279 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +137 -18
- package/dist/config.js +187 -106
- package/dist/config.js.map +1 -0
- package/dist/connect.d.ts +89 -0
- package/dist/connect.js +269 -0
- package/dist/connect.js.map +1 -0
- package/dist/doctor.d.ts +24 -0
- package/dist/doctor.js +120 -0
- package/dist/doctor.js.map +1 -0
- package/dist/events.d.ts +186 -0
- package/dist/events.js +407 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +124 -184
- package/dist/index.js.map +1 -0
- package/dist/instructions.d.ts +12 -0
- package/dist/instructions.js +114 -0
- package/dist/instructions.js.map +1 -0
- package/dist/mint.d.ts +62 -0
- package/dist/mint.js +135 -0
- package/dist/mint.js.map +1 -0
- package/dist/mirror.d.ts +68 -0
- package/dist/mirror.js +103 -0
- package/dist/mirror.js.map +1 -0
- package/dist/pane-queue.d.ts +29 -0
- package/dist/pane-queue.js +35 -0
- package/dist/pane-queue.js.map +1 -0
- package/dist/prompts.d.ts +79 -0
- package/dist/prompts.js +211 -0
- package/dist/prompts.js.map +1 -0
- package/dist/resolve.d.ts +72 -0
- package/dist/resolve.js +89 -0
- package/dist/resolve.js.map +1 -0
- package/dist/runtime.d.ts +54 -0
- package/dist/runtime.js +321 -0
- package/dist/runtime.js.map +1 -0
- package/dist/server.d.ts +56 -0
- package/dist/server.js +793 -0
- package/dist/server.js.map +1 -0
- package/dist/session-identifier.d.ts +48 -0
- package/dist/session-identifier.js +44 -0
- package/dist/session-identifier.js.map +1 -0
- package/dist/sessions-store.d.ts +38 -0
- package/dist/sessions-store.js +88 -0
- package/dist/sessions-store.js.map +1 -0
- package/dist/tmux.d.ts +200 -0
- package/dist/tmux.js +580 -0
- package/dist/tmux.js.map +1 -0
- package/hooks/metadata.mjs +99 -0
- package/hooks/permission-prompt.mjs +100 -0
- package/hooks/taskflow-hook.mjs +499 -0
- package/hooks/tool-logging.mjs +63 -0
- package/package.json +38 -29
- package/dist/agent-registry.d.ts +0 -27
- package/dist/agent-registry.js +0 -153
- package/dist/db.d.ts +0 -5
- package/dist/db.js +0 -220
- package/dist/helpers.d.ts +0 -21
- package/dist/helpers.js +0 -27
- package/dist/resources.d.ts +0 -2
- package/dist/resources.js +0 -89
- package/dist/sse.d.ts +0 -10
- package/dist/sse.js +0 -766
- package/dist/tmux-bridge.d.ts +0 -12
- package/dist/tmux-bridge.js +0 -157
- package/dist/tools/activity.d.ts +0 -39
- package/dist/tools/activity.js +0 -152
- package/dist/tools/agent-inbox.d.ts +0 -12
- package/dist/tools/agent-inbox.js +0 -257
- package/dist/tools/agent.d.ts +0 -14
- package/dist/tools/agent.js +0 -168
- package/dist/tools/analytics.d.ts +0 -21
- package/dist/tools/analytics.js +0 -191
- package/dist/tools/checkpoint.d.ts +0 -27
- package/dist/tools/checkpoint.js +0 -105
- package/dist/tools/notifications.d.ts +0 -31
- package/dist/tools/notifications.js +0 -59
- package/dist/tools/projects.d.ts +0 -55
- package/dist/tools/projects.js +0 -112
- package/dist/tools/settings.d.ts +0 -19
- package/dist/tools/settings.js +0 -73
- package/dist/tools/tasks.d.ts +0 -105
- package/dist/tools/tasks.js +0 -403
- package/dist/tools/terminal.d.ts +0 -4
- package/dist/tools/terminal.js +0 -98
- package/dist/tools/timer.d.ts +0 -37
- package/dist/tools/timer.js +0 -154
- package/dist/types.d.ts +0 -82
- package/dist/types.js +0 -30
package/dist/tools/timer.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { getDb } from '../db.js';
|
|
3
|
-
import { logActivity, errorResponse, successResponse, now, broadcastChange } from '../helpers.js';
|
|
4
|
-
import { VALID_TRANSITIONS } from '../types.js';
|
|
5
|
-
// ─── exported handler functions ───────────────────────────────────────
|
|
6
|
-
export async function startTimer(params) {
|
|
7
|
-
const db = getDb();
|
|
8
|
-
const task = db.prepare('SELECT id, title, status FROM tasks WHERE id = ?').get(params.task_id);
|
|
9
|
-
if (!task)
|
|
10
|
-
return errorResponse('Task not found', 'NOT_FOUND');
|
|
11
|
-
// Check no open session exists
|
|
12
|
-
const openSession = db.prepare('SELECT id FROM sessions WHERE task_id = ? AND end IS NULL').get(params.task_id);
|
|
13
|
-
if (openSession)
|
|
14
|
-
return errorResponse('A timer session is already active for this task', 'SESSION_ALREADY_ACTIVE');
|
|
15
|
-
// Check valid transition to in_progress
|
|
16
|
-
const currentStatus = task.status;
|
|
17
|
-
const allowed = VALID_TRANSITIONS[currentStatus];
|
|
18
|
-
if (!allowed || !allowed.includes('in_progress')) {
|
|
19
|
-
return errorResponse(`Cannot transition from "${currentStatus}" to "in_progress"`, 'INVALID_TRANSITION');
|
|
20
|
-
}
|
|
21
|
-
const ts = now();
|
|
22
|
-
// Create session
|
|
23
|
-
const result = db.prepare('INSERT INTO sessions (task_id, start, end) VALUES (?, ?, ?)').run(params.task_id, ts, null);
|
|
24
|
-
// Update task status to in_progress
|
|
25
|
-
db.prepare('UPDATE tasks SET status = ?, updated_at = ? WHERE id = ?').run('in_progress', ts, params.task_id);
|
|
26
|
-
logActivity('timer_started', task.title, { entityType: 'task', entityId: params.task_id });
|
|
27
|
-
const session = db.prepare('SELECT * FROM sessions WHERE id = ?').get(result.lastInsertRowid);
|
|
28
|
-
broadcastChange('timer', 'timer_started', { task_id: params.task_id, session, task_status: 'in_progress' });
|
|
29
|
-
return successResponse(session);
|
|
30
|
-
}
|
|
31
|
-
export async function pauseTimer(params) {
|
|
32
|
-
const db = getDb();
|
|
33
|
-
const task = db.prepare('SELECT id, title, status FROM tasks WHERE id = ?').get(params.task_id);
|
|
34
|
-
if (!task)
|
|
35
|
-
return errorResponse('Task not found', 'NOT_FOUND');
|
|
36
|
-
// Find open session
|
|
37
|
-
const session = db.prepare('SELECT * FROM sessions WHERE task_id = ? AND end IS NULL').get(params.task_id);
|
|
38
|
-
const endTime = now();
|
|
39
|
-
let duration;
|
|
40
|
-
let closedSession;
|
|
41
|
-
if (session) {
|
|
42
|
-
// Normal path — close the active session
|
|
43
|
-
duration = new Date(endTime).getTime() - new Date(session.start).getTime();
|
|
44
|
-
db.prepare('UPDATE sessions SET end = ? WHERE id = ?').run(endTime, session.id);
|
|
45
|
-
closedSession = { ...session, end: endTime };
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// Fallback — session already closed (orphan cleanup, auto-close)
|
|
49
|
-
const lastSession = db.prepare('SELECT * FROM sessions WHERE task_id = ? ORDER BY start DESC LIMIT 1').get(params.task_id);
|
|
50
|
-
if (!lastSession)
|
|
51
|
-
return errorResponse('No timer sessions found for this task', 'NO_ACTIVE_SESSION');
|
|
52
|
-
duration = new Date(lastSession.end).getTime() - new Date(lastSession.start).getTime();
|
|
53
|
-
closedSession = lastSession;
|
|
54
|
-
}
|
|
55
|
-
// Update task to paused
|
|
56
|
-
db.prepare('UPDATE tasks SET status = ?, updated_at = ? WHERE id = ?').run('paused', endTime, params.task_id);
|
|
57
|
-
logActivity('timer_paused', task.title, {
|
|
58
|
-
detail: `Duration: ${duration}ms`,
|
|
59
|
-
entityType: 'task',
|
|
60
|
-
entityId: params.task_id,
|
|
61
|
-
});
|
|
62
|
-
const pausedSession = { ...closedSession, duration };
|
|
63
|
-
broadcastChange('timer', 'timer_paused', { task_id: params.task_id, session: pausedSession, task_status: 'paused' });
|
|
64
|
-
return successResponse(pausedSession);
|
|
65
|
-
}
|
|
66
|
-
export async function stopTimer(params) {
|
|
67
|
-
const db = getDb();
|
|
68
|
-
const task = db.prepare('SELECT id, title, status FROM tasks WHERE id = ?').get(params.task_id);
|
|
69
|
-
if (!task)
|
|
70
|
-
return errorResponse('Task not found', 'NOT_FOUND');
|
|
71
|
-
// Find open session
|
|
72
|
-
const session = db.prepare('SELECT * FROM sessions WHERE task_id = ? AND end IS NULL').get(params.task_id);
|
|
73
|
-
const finalStatus = params.final_status ?? 'done';
|
|
74
|
-
const endTime = now();
|
|
75
|
-
let duration;
|
|
76
|
-
let closedSession;
|
|
77
|
-
if (session) {
|
|
78
|
-
// Normal path — close the active session
|
|
79
|
-
duration = new Date(endTime).getTime() - new Date(session.start).getTime();
|
|
80
|
-
db.prepare('UPDATE sessions SET end = ? WHERE id = ?').run(endTime, session.id);
|
|
81
|
-
closedSession = { ...session, end: endTime };
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// Fallback — session was already closed (e.g. by orphan cleanup or update_task_status)
|
|
85
|
-
// Still update the task status so the caller's intent is honored
|
|
86
|
-
const lastSession = db.prepare('SELECT * FROM sessions WHERE task_id = ? ORDER BY start DESC LIMIT 1').get(params.task_id);
|
|
87
|
-
if (!lastSession)
|
|
88
|
-
return errorResponse('No timer sessions found for this task', 'NO_ACTIVE_SESSION');
|
|
89
|
-
duration = new Date(lastSession.end).getTime() - new Date(lastSession.start).getTime();
|
|
90
|
-
closedSession = lastSession;
|
|
91
|
-
}
|
|
92
|
-
// Update task to final_status
|
|
93
|
-
db.prepare('UPDATE tasks SET status = ?, updated_at = ? WHERE id = ?').run(finalStatus, endTime, params.task_id);
|
|
94
|
-
logActivity('timer_stopped', task.title, {
|
|
95
|
-
detail: `Duration: ${duration}ms, final status: ${finalStatus}`,
|
|
96
|
-
entityType: 'task',
|
|
97
|
-
entityId: params.task_id,
|
|
98
|
-
});
|
|
99
|
-
// Also log status-specific action
|
|
100
|
-
if (finalStatus === 'done') {
|
|
101
|
-
logActivity('task_completed', task.title, { entityType: 'task', entityId: params.task_id });
|
|
102
|
-
}
|
|
103
|
-
else if (finalStatus === 'partial_done') {
|
|
104
|
-
logActivity('task_partial_done', task.title, { entityType: 'task', entityId: params.task_id });
|
|
105
|
-
}
|
|
106
|
-
const stoppedSession = { ...closedSession, duration };
|
|
107
|
-
broadcastChange('timer', 'timer_stopped', { task_id: params.task_id, session: stoppedSession, task_status: finalStatus });
|
|
108
|
-
return successResponse(stoppedSession);
|
|
109
|
-
}
|
|
110
|
-
export async function listSessions(params) {
|
|
111
|
-
const db = getDb();
|
|
112
|
-
const conditions = [];
|
|
113
|
-
const values = [];
|
|
114
|
-
if (params.task_id != null) {
|
|
115
|
-
conditions.push('task_id = ?');
|
|
116
|
-
values.push(params.task_id);
|
|
117
|
-
}
|
|
118
|
-
if (params.start_date) {
|
|
119
|
-
conditions.push('start >= ?');
|
|
120
|
-
values.push(params.start_date);
|
|
121
|
-
}
|
|
122
|
-
if (params.end_date) {
|
|
123
|
-
conditions.push('start <= ?');
|
|
124
|
-
values.push(params.end_date);
|
|
125
|
-
}
|
|
126
|
-
let sql = 'SELECT * FROM sessions';
|
|
127
|
-
if (conditions.length > 0) {
|
|
128
|
-
sql += ' WHERE ' + conditions.join(' AND ');
|
|
129
|
-
}
|
|
130
|
-
sql += ' ORDER BY start ASC';
|
|
131
|
-
const rows = db.prepare(sql).all(...values);
|
|
132
|
-
const nowMs = Date.now();
|
|
133
|
-
const sessions = rows.map(row => {
|
|
134
|
-
const startMs = new Date(row.start).getTime();
|
|
135
|
-
const endMs = row.end ? new Date(row.end).getTime() : nowMs;
|
|
136
|
-
const duration = endMs - startMs;
|
|
137
|
-
return { ...row, duration };
|
|
138
|
-
});
|
|
139
|
-
return successResponse(sessions);
|
|
140
|
-
}
|
|
141
|
-
// ─── MCP registration ─────────────────────────────────────────────────
|
|
142
|
-
export function registerTimerTools(server) {
|
|
143
|
-
server.tool('start_timer', 'Start a timer session for a task. Call this before beginning work on any task to track focused time. Automatically transitions the task to "in_progress".', { task_id: z.number() }, { readOnlyHint: false }, async (params) => startTimer(params));
|
|
144
|
-
server.tool('pause_timer', 'Pause the active timer session for a task. Call when switching context or waiting for user input. The task transitions to "paused".', { task_id: z.number() }, { readOnlyHint: false }, async (params) => pauseTimer(params));
|
|
145
|
-
server.tool('stop_timer', 'Stop the active timer and set a final status. Call when finishing work — use "done" if complete, "partial_done" if more remains, "blocked" if stuck.', {
|
|
146
|
-
task_id: z.number(),
|
|
147
|
-
final_status: z.enum(['done', 'partial_done', 'blocked']).optional(),
|
|
148
|
-
}, { readOnlyHint: false }, async (params) => stopTimer(params));
|
|
149
|
-
server.tool('list_sessions', 'List timer sessions with optional filters. Use to review time spent on a task or across a date range.', {
|
|
150
|
-
task_id: z.number().optional(),
|
|
151
|
-
start_date: z.string().optional(),
|
|
152
|
-
end_date: z.string().optional(),
|
|
153
|
-
}, { readOnlyHint: true }, async (params) => listSessions(params));
|
|
154
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const TaskStatus: z.ZodEnum<{
|
|
3
|
-
not_started: "not_started";
|
|
4
|
-
in_progress: "in_progress";
|
|
5
|
-
paused: "paused";
|
|
6
|
-
blocked: "blocked";
|
|
7
|
-
partial_done: "partial_done";
|
|
8
|
-
done: "done";
|
|
9
|
-
}>;
|
|
10
|
-
export type TaskStatus = z.infer<typeof TaskStatus>;
|
|
11
|
-
export declare const TaskPriority: z.ZodEnum<{
|
|
12
|
-
low: "low";
|
|
13
|
-
medium: "medium";
|
|
14
|
-
high: "high";
|
|
15
|
-
critical: "critical";
|
|
16
|
-
}>;
|
|
17
|
-
export type TaskPriority = z.infer<typeof TaskPriority>;
|
|
18
|
-
export declare const ProjectType: z.ZodEnum<{
|
|
19
|
-
active_project: "active_project";
|
|
20
|
-
project_idea: "project_idea";
|
|
21
|
-
}>;
|
|
22
|
-
export type ProjectType = z.infer<typeof ProjectType>;
|
|
23
|
-
export declare const NotificationType: z.ZodEnum<{
|
|
24
|
-
info: "info";
|
|
25
|
-
error: "error";
|
|
26
|
-
success: "success";
|
|
27
|
-
warning: "warning";
|
|
28
|
-
}>;
|
|
29
|
-
export type NotificationType = z.infer<typeof NotificationType>;
|
|
30
|
-
export declare const AgentMessageStatus: z.ZodEnum<{
|
|
31
|
-
pending: "pending";
|
|
32
|
-
answered: "answered";
|
|
33
|
-
dismissed: "dismissed";
|
|
34
|
-
}>;
|
|
35
|
-
export type AgentMessageStatus = z.infer<typeof AgentMessageStatus>;
|
|
36
|
-
export declare const AgentStatus: z.ZodEnum<{
|
|
37
|
-
connected: "connected";
|
|
38
|
-
disconnected: "disconnected";
|
|
39
|
-
}>;
|
|
40
|
-
export type AgentStatus = z.infer<typeof AgentStatus>;
|
|
41
|
-
export declare const ActivityAction: z.ZodEnum<{
|
|
42
|
-
task_created: "task_created";
|
|
43
|
-
task_deleted: "task_deleted";
|
|
44
|
-
task_status_changed: "task_status_changed";
|
|
45
|
-
task_completed: "task_completed";
|
|
46
|
-
task_partial_done: "task_partial_done";
|
|
47
|
-
timer_started: "timer_started";
|
|
48
|
-
timer_paused: "timer_paused";
|
|
49
|
-
timer_stopped: "timer_stopped";
|
|
50
|
-
project_created: "project_created";
|
|
51
|
-
project_deleted: "project_deleted";
|
|
52
|
-
project_updated: "project_updated";
|
|
53
|
-
tasks_bulk_created: "tasks_bulk_created";
|
|
54
|
-
settings_saved: "settings_saved";
|
|
55
|
-
data_seeded: "data_seeded";
|
|
56
|
-
data_cleared: "data_cleared";
|
|
57
|
-
task_linked: "task_linked";
|
|
58
|
-
task_unlinked: "task_unlinked";
|
|
59
|
-
dependency_added: "dependency_added";
|
|
60
|
-
dependency_removed: "dependency_removed";
|
|
61
|
-
link_added: "link_added";
|
|
62
|
-
tag_added: "tag_added";
|
|
63
|
-
tag_removed: "tag_removed";
|
|
64
|
-
debug_log: "debug_log";
|
|
65
|
-
agent_question: "agent_question";
|
|
66
|
-
agent_question_answered: "agent_question_answered";
|
|
67
|
-
agent_broadcast: "agent_broadcast";
|
|
68
|
-
agent_connected: "agent_connected";
|
|
69
|
-
agent_disconnected: "agent_disconnected";
|
|
70
|
-
agent_renamed: "agent_renamed";
|
|
71
|
-
terminal_send_keys: "terminal_send_keys";
|
|
72
|
-
terminal_captured: "terminal_captured";
|
|
73
|
-
compaction_summary: "compaction_summary";
|
|
74
|
-
activity_compacted: "activity_compacted";
|
|
75
|
-
}>;
|
|
76
|
-
export type ActivityAction = z.infer<typeof ActivityAction>;
|
|
77
|
-
export declare const VALID_TRANSITIONS: Record<TaskStatus, TaskStatus[]>;
|
|
78
|
-
export type ErrorCode = 'NOT_FOUND' | 'INVALID_TRANSITION' | 'VALIDATION_ERROR' | 'CYCLE_DETECTED' | 'SESSION_ALREADY_ACTIVE' | 'NO_ACTIVE_SESSION' | 'ALREADY_ANSWERED';
|
|
79
|
-
export declare const LinkSchema: z.ZodObject<{
|
|
80
|
-
label: z.ZodString;
|
|
81
|
-
url: z.ZodString;
|
|
82
|
-
}, z.core.$strip>;
|
package/dist/types.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const TaskStatus = z.enum([
|
|
3
|
-
'not_started', 'in_progress', 'paused', 'blocked', 'partial_done', 'done'
|
|
4
|
-
]);
|
|
5
|
-
export const TaskPriority = z.enum(['low', 'medium', 'high', 'critical']);
|
|
6
|
-
export const ProjectType = z.enum(['active_project', 'project_idea']);
|
|
7
|
-
export const NotificationType = z.enum(['info', 'success', 'warning', 'error']);
|
|
8
|
-
export const AgentMessageStatus = z.enum(['pending', 'answered', 'dismissed']);
|
|
9
|
-
export const AgentStatus = z.enum(['connected', 'disconnected']);
|
|
10
|
-
export const ActivityAction = z.enum([
|
|
11
|
-
'task_created', 'task_deleted', 'task_status_changed', 'task_completed',
|
|
12
|
-
'task_partial_done', 'timer_started', 'timer_paused', 'timer_stopped',
|
|
13
|
-
'project_created', 'project_deleted', 'project_updated',
|
|
14
|
-
'tasks_bulk_created', 'settings_saved', 'data_seeded', 'data_cleared',
|
|
15
|
-
'task_linked', 'task_unlinked', 'dependency_added', 'dependency_removed',
|
|
16
|
-
'link_added', 'tag_added', 'tag_removed', 'debug_log',
|
|
17
|
-
'agent_question', 'agent_question_answered', 'agent_broadcast',
|
|
18
|
-
'agent_connected', 'agent_disconnected', 'agent_renamed',
|
|
19
|
-
'terminal_send_keys', 'terminal_captured',
|
|
20
|
-
'compaction_summary', 'activity_compacted',
|
|
21
|
-
]);
|
|
22
|
-
export const VALID_TRANSITIONS = {
|
|
23
|
-
not_started: ['in_progress', 'blocked'],
|
|
24
|
-
in_progress: ['paused', 'blocked', 'partial_done', 'done'],
|
|
25
|
-
paused: ['in_progress', 'blocked', 'partial_done', 'done'],
|
|
26
|
-
blocked: ['not_started', 'in_progress'],
|
|
27
|
-
partial_done: ['in_progress', 'done'],
|
|
28
|
-
done: ['in_progress'],
|
|
29
|
-
};
|
|
30
|
-
export const LinkSchema = z.object({ label: z.string(), url: z.string() });
|