@hasna/todos 0.10.4 → 0.10.5
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/cli/index.js +99 -9
- package/dist/db/task-files.d.ts +16 -0
- package/dist/db/task-files.d.ts.map +1 -1
- package/dist/mcp/index.js +109 -8
- package/dist/server/index.js +5 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -6,39 +6,60 @@ var __defProp = Object.defineProperty;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
function __accessProp(key) {
|
|
10
|
+
return this[key];
|
|
11
|
+
}
|
|
12
|
+
var __toESMCache_node;
|
|
13
|
+
var __toESMCache_esm;
|
|
9
14
|
var __toESM = (mod, isNodeMode, target) => {
|
|
15
|
+
var canCache = mod != null && typeof mod === "object";
|
|
16
|
+
if (canCache) {
|
|
17
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
18
|
+
var cached = cache.get(mod);
|
|
19
|
+
if (cached)
|
|
20
|
+
return cached;
|
|
21
|
+
}
|
|
10
22
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
11
23
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
12
24
|
for (let key of __getOwnPropNames(mod))
|
|
13
25
|
if (!__hasOwnProp.call(to, key))
|
|
14
26
|
__defProp(to, key, {
|
|
15
|
-
get: (
|
|
27
|
+
get: __accessProp.bind(mod, key),
|
|
16
28
|
enumerable: true
|
|
17
29
|
});
|
|
30
|
+
if (canCache)
|
|
31
|
+
cache.set(mod, to);
|
|
18
32
|
return to;
|
|
19
33
|
};
|
|
20
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
21
34
|
var __toCommonJS = (from) => {
|
|
22
|
-
var entry = __moduleCache.get(from), desc;
|
|
35
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
23
36
|
if (entry)
|
|
24
37
|
return entry;
|
|
25
38
|
entry = __defProp({}, "__esModule", { value: true });
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
40
|
+
for (var key of __getOwnPropNames(from))
|
|
41
|
+
if (!__hasOwnProp.call(entry, key))
|
|
42
|
+
__defProp(entry, key, {
|
|
43
|
+
get: __accessProp.bind(from, key),
|
|
44
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
45
|
+
});
|
|
46
|
+
}
|
|
31
47
|
__moduleCache.set(from, entry);
|
|
32
48
|
return entry;
|
|
33
49
|
};
|
|
50
|
+
var __moduleCache;
|
|
34
51
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
52
|
+
var __returnValue = (v) => v;
|
|
53
|
+
function __exportSetter(name, newValue) {
|
|
54
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
55
|
+
}
|
|
35
56
|
var __export = (target, all) => {
|
|
36
57
|
for (var name in all)
|
|
37
58
|
__defProp(target, name, {
|
|
38
59
|
get: all[name],
|
|
39
60
|
enumerable: true,
|
|
40
61
|
configurable: true,
|
|
41
|
-
set: (
|
|
62
|
+
set: __exportSetter.bind(all, name)
|
|
42
63
|
});
|
|
43
64
|
};
|
|
44
65
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -9774,6 +9795,7 @@ __export(exports_task_files, {
|
|
|
9774
9795
|
updateTaskFileStatus: () => updateTaskFileStatus,
|
|
9775
9796
|
removeTaskFile: () => removeTaskFile,
|
|
9776
9797
|
listTaskFiles: () => listTaskFiles,
|
|
9798
|
+
listActiveFiles: () => listActiveFiles,
|
|
9777
9799
|
getTaskFile: () => getTaskFile,
|
|
9778
9800
|
findTasksByFile: () => findTasksByFile,
|
|
9779
9801
|
bulkAddTaskFiles: () => bulkAddTaskFiles,
|
|
@@ -9816,6 +9838,31 @@ function removeTaskFile(taskId, path, db) {
|
|
|
9816
9838
|
const result = d.run("DELETE FROM task_files WHERE task_id = ? AND path = ?", [taskId, path]);
|
|
9817
9839
|
return result.changes > 0;
|
|
9818
9840
|
}
|
|
9841
|
+
function listActiveFiles(db) {
|
|
9842
|
+
const d = db || getDatabase();
|
|
9843
|
+
return d.query(`
|
|
9844
|
+
SELECT
|
|
9845
|
+
tf.path,
|
|
9846
|
+
tf.status AS file_status,
|
|
9847
|
+
tf.agent_id AS file_agent_id,
|
|
9848
|
+
tf.note,
|
|
9849
|
+
tf.updated_at,
|
|
9850
|
+
t.id AS task_id,
|
|
9851
|
+
t.short_id AS task_short_id,
|
|
9852
|
+
t.title AS task_title,
|
|
9853
|
+
t.status AS task_status,
|
|
9854
|
+
t.locked_by AS task_locked_by,
|
|
9855
|
+
t.locked_at AS task_locked_at,
|
|
9856
|
+
a.id AS agent_id,
|
|
9857
|
+
a.name AS agent_name
|
|
9858
|
+
FROM task_files tf
|
|
9859
|
+
JOIN tasks t ON tf.task_id = t.id
|
|
9860
|
+
LEFT JOIN agents a ON (tf.agent_id = a.id OR (tf.agent_id IS NULL AND t.assigned_to = a.id))
|
|
9861
|
+
WHERE t.status = 'in_progress'
|
|
9862
|
+
AND tf.status != 'removed'
|
|
9863
|
+
ORDER BY tf.updated_at DESC
|
|
9864
|
+
`).all();
|
|
9865
|
+
}
|
|
9819
9866
|
function bulkAddTaskFiles(taskId, paths, agentId, db) {
|
|
9820
9867
|
const d = db || getDatabase();
|
|
9821
9868
|
const results = [];
|
|
@@ -13189,6 +13236,49 @@ ${lines.join(`
|
|
|
13189
13236
|
}
|
|
13190
13237
|
});
|
|
13191
13238
|
}
|
|
13239
|
+
if (shouldRegisterTool("list_active_files")) {
|
|
13240
|
+
server.tool("list_active_files", "Return all files linked to in-progress tasks across all agents \u2014 the bird's-eye view of what's being worked on right now.", {
|
|
13241
|
+
project_id: exports_external.string().optional().describe("Filter by project")
|
|
13242
|
+
}, async ({ project_id }) => {
|
|
13243
|
+
try {
|
|
13244
|
+
const { listActiveFiles: listActiveFiles2 } = (init_task_files(), __toCommonJS(exports_task_files));
|
|
13245
|
+
let files = listActiveFiles2();
|
|
13246
|
+
if (project_id) {
|
|
13247
|
+
const pid = resolveId(project_id, "projects");
|
|
13248
|
+
const db = (init_database(), __toCommonJS(exports_database)).getDatabase();
|
|
13249
|
+
files = db.query(`
|
|
13250
|
+
SELECT
|
|
13251
|
+
tf.path,
|
|
13252
|
+
tf.status AS file_status,
|
|
13253
|
+
tf.agent_id AS file_agent_id,
|
|
13254
|
+
tf.note,
|
|
13255
|
+
tf.updated_at,
|
|
13256
|
+
t.id AS task_id,
|
|
13257
|
+
t.short_id AS task_short_id,
|
|
13258
|
+
t.title AS task_title,
|
|
13259
|
+
t.status AS task_status,
|
|
13260
|
+
t.locked_by AS task_locked_by,
|
|
13261
|
+
t.locked_at AS task_locked_at,
|
|
13262
|
+
a.id AS agent_id,
|
|
13263
|
+
a.name AS agent_name
|
|
13264
|
+
FROM task_files tf
|
|
13265
|
+
JOIN tasks t ON tf.task_id = t.id
|
|
13266
|
+
LEFT JOIN agents a ON (tf.agent_id = a.id OR (tf.agent_id IS NULL AND t.assigned_to = a.id))
|
|
13267
|
+
WHERE t.status = 'in_progress'
|
|
13268
|
+
AND tf.status != 'removed'
|
|
13269
|
+
AND t.project_id = ?
|
|
13270
|
+
ORDER BY tf.updated_at DESC
|
|
13271
|
+
`).all(pid);
|
|
13272
|
+
}
|
|
13273
|
+
if (files.length === 0) {
|
|
13274
|
+
return { content: [{ type: "text", text: "No active files \u2014 no in-progress tasks have linked files." }] };
|
|
13275
|
+
}
|
|
13276
|
+
return { content: [{ type: "text", text: JSON.stringify(files, null, 2) }] };
|
|
13277
|
+
} catch (e) {
|
|
13278
|
+
return { content: [{ type: "text", text: formatError(e) }], isError: true };
|
|
13279
|
+
}
|
|
13280
|
+
});
|
|
13281
|
+
}
|
|
13192
13282
|
if (shouldRegisterTool("create_handoff")) {
|
|
13193
13283
|
server.tool("create_handoff", "Create a session handoff note for agent coordination.", {
|
|
13194
13284
|
agent_id: exports_external.string().optional().describe("Agent creating the handoff"),
|
package/dist/db/task-files.d.ts
CHANGED
|
@@ -22,5 +22,21 @@ export declare function listTaskFiles(taskId: string, db?: Database): TaskFile[]
|
|
|
22
22
|
export declare function findTasksByFile(path: string, db?: Database): TaskFile[];
|
|
23
23
|
export declare function updateTaskFileStatus(taskId: string, path: string, status: TaskFile["status"], agentId?: string, db?: Database): TaskFile | null;
|
|
24
24
|
export declare function removeTaskFile(taskId: string, path: string, db?: Database): boolean;
|
|
25
|
+
export interface ActiveFileInfo {
|
|
26
|
+
path: string;
|
|
27
|
+
file_status: TaskFile["status"];
|
|
28
|
+
file_agent_id: string | null;
|
|
29
|
+
note: string | null;
|
|
30
|
+
updated_at: string;
|
|
31
|
+
task_id: string;
|
|
32
|
+
task_short_id: string | null;
|
|
33
|
+
task_title: string;
|
|
34
|
+
task_status: string;
|
|
35
|
+
task_locked_by: string | null;
|
|
36
|
+
task_locked_at: string | null;
|
|
37
|
+
agent_id: string | null;
|
|
38
|
+
agent_name: string | null;
|
|
39
|
+
}
|
|
40
|
+
export declare function listActiveFiles(db?: Database): ActiveFileInfo[];
|
|
25
41
|
export declare function bulkAddTaskFiles(taskId: string, paths: string[], agentId?: string, db?: Database): TaskFile[];
|
|
26
42
|
//# sourceMappingURL=task-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-files.d.ts","sourceRoot":"","sources":["../../src/db/task-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,QAAQ;IACvB,EAAE,EA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perty;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
8
10
|
var __toCommonJS = (from) => {
|
|
9
|
-
var entry = __moduleCache.get(from), desc;
|
|
11
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
12
|
if (entry)
|
|
11
13
|
return entry;
|
|
12
14
|
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (var key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(entry, key))
|
|
18
|
+
__defProp(entry, key, {
|
|
19
|
+
get: __accessProp.bind(from, key),
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
18
23
|
__moduleCache.set(from, entry);
|
|
19
24
|
return entry;
|
|
20
25
|
};
|
|
26
|
+
var __moduleCache;
|
|
27
|
+
var __returnValue = (v) => v;
|
|
28
|
+
function __exportSetter(name, newValue) {
|
|
29
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
30
|
+
}
|
|
21
31
|
var __export = (target, all) => {
|
|
22
32
|
for (var name in all)
|
|
23
33
|
__defProp(target, name, {
|
|
24
34
|
get: all[name],
|
|
25
35
|
enumerable: true,
|
|
26
36
|
configurable: true,
|
|
27
|
-
set: (
|
|
37
|
+
set: __exportSetter.bind(all, name)
|
|
28
38
|
});
|
|
29
39
|
};
|
|
30
40
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
31
41
|
|
|
32
42
|
// src/db/database.ts
|
|
43
|
+
var exports_database = {};
|
|
44
|
+
__export(exports_database, {
|
|
45
|
+
uuid: () => uuid,
|
|
46
|
+
resolvePartialId: () => resolvePartialId,
|
|
47
|
+
resetDatabase: () => resetDatabase,
|
|
48
|
+
now: () => now,
|
|
49
|
+
lockExpiryCutoff: () => lockExpiryCutoff,
|
|
50
|
+
isLockExpired: () => isLockExpired,
|
|
51
|
+
getDatabase: () => getDatabase,
|
|
52
|
+
closeDatabase: () => closeDatabase,
|
|
53
|
+
clearExpiredLocks: () => clearExpiredLocks,
|
|
54
|
+
LOCK_EXPIRY_MINUTES: () => LOCK_EXPIRY_MINUTES
|
|
55
|
+
});
|
|
33
56
|
import { Database } from "bun:sqlite";
|
|
34
57
|
import { existsSync, mkdirSync } from "fs";
|
|
35
58
|
import { dirname, join, resolve } from "path";
|
|
@@ -332,6 +355,15 @@ function backfillTaskTags(db) {
|
|
|
332
355
|
}
|
|
333
356
|
} catch {}
|
|
334
357
|
}
|
|
358
|
+
function closeDatabase() {
|
|
359
|
+
if (_db) {
|
|
360
|
+
_db.close();
|
|
361
|
+
_db = null;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function resetDatabase() {
|
|
365
|
+
_db = null;
|
|
366
|
+
}
|
|
335
367
|
function now() {
|
|
336
368
|
return new Date().toISOString();
|
|
337
369
|
}
|
|
@@ -1203,6 +1235,7 @@ __export(exports_task_files, {
|
|
|
1203
1235
|
updateTaskFileStatus: () => updateTaskFileStatus,
|
|
1204
1236
|
removeTaskFile: () => removeTaskFile,
|
|
1205
1237
|
listTaskFiles: () => listTaskFiles,
|
|
1238
|
+
listActiveFiles: () => listActiveFiles,
|
|
1206
1239
|
getTaskFile: () => getTaskFile,
|
|
1207
1240
|
findTasksByFile: () => findTasksByFile,
|
|
1208
1241
|
bulkAddTaskFiles: () => bulkAddTaskFiles,
|
|
@@ -1245,6 +1278,31 @@ function removeTaskFile(taskId, path, db) {
|
|
|
1245
1278
|
const result = d.run("DELETE FROM task_files WHERE task_id = ? AND path = ?", [taskId, path]);
|
|
1246
1279
|
return result.changes > 0;
|
|
1247
1280
|
}
|
|
1281
|
+
function listActiveFiles(db) {
|
|
1282
|
+
const d = db || getDatabase();
|
|
1283
|
+
return d.query(`
|
|
1284
|
+
SELECT
|
|
1285
|
+
tf.path,
|
|
1286
|
+
tf.status AS file_status,
|
|
1287
|
+
tf.agent_id AS file_agent_id,
|
|
1288
|
+
tf.note,
|
|
1289
|
+
tf.updated_at,
|
|
1290
|
+
t.id AS task_id,
|
|
1291
|
+
t.short_id AS task_short_id,
|
|
1292
|
+
t.title AS task_title,
|
|
1293
|
+
t.status AS task_status,
|
|
1294
|
+
t.locked_by AS task_locked_by,
|
|
1295
|
+
t.locked_at AS task_locked_at,
|
|
1296
|
+
a.id AS agent_id,
|
|
1297
|
+
a.name AS agent_name
|
|
1298
|
+
FROM task_files tf
|
|
1299
|
+
JOIN tasks t ON tf.task_id = t.id
|
|
1300
|
+
LEFT JOIN agents a ON (tf.agent_id = a.id OR (tf.agent_id IS NULL AND t.assigned_to = a.id))
|
|
1301
|
+
WHERE t.status = 'in_progress'
|
|
1302
|
+
AND tf.status != 'removed'
|
|
1303
|
+
ORDER BY tf.updated_at DESC
|
|
1304
|
+
`).all();
|
|
1305
|
+
}
|
|
1248
1306
|
function bulkAddTaskFiles(taskId, paths, agentId, db) {
|
|
1249
1307
|
const d = db || getDatabase();
|
|
1250
1308
|
const results = [];
|
|
@@ -10902,6 +10960,49 @@ ${lines.join(`
|
|
|
10902
10960
|
}
|
|
10903
10961
|
});
|
|
10904
10962
|
}
|
|
10963
|
+
if (shouldRegisterTool("list_active_files")) {
|
|
10964
|
+
server.tool("list_active_files", "Return all files linked to in-progress tasks across all agents \u2014 the bird's-eye view of what's being worked on right now.", {
|
|
10965
|
+
project_id: exports_external.string().optional().describe("Filter by project")
|
|
10966
|
+
}, async ({ project_id }) => {
|
|
10967
|
+
try {
|
|
10968
|
+
const { listActiveFiles: listActiveFiles2 } = (init_task_files(), __toCommonJS(exports_task_files));
|
|
10969
|
+
let files = listActiveFiles2();
|
|
10970
|
+
if (project_id) {
|
|
10971
|
+
const pid = resolveId(project_id, "projects");
|
|
10972
|
+
const db = (init_database(), __toCommonJS(exports_database)).getDatabase();
|
|
10973
|
+
files = db.query(`
|
|
10974
|
+
SELECT
|
|
10975
|
+
tf.path,
|
|
10976
|
+
tf.status AS file_status,
|
|
10977
|
+
tf.agent_id AS file_agent_id,
|
|
10978
|
+
tf.note,
|
|
10979
|
+
tf.updated_at,
|
|
10980
|
+
t.id AS task_id,
|
|
10981
|
+
t.short_id AS task_short_id,
|
|
10982
|
+
t.title AS task_title,
|
|
10983
|
+
t.status AS task_status,
|
|
10984
|
+
t.locked_by AS task_locked_by,
|
|
10985
|
+
t.locked_at AS task_locked_at,
|
|
10986
|
+
a.id AS agent_id,
|
|
10987
|
+
a.name AS agent_name
|
|
10988
|
+
FROM task_files tf
|
|
10989
|
+
JOIN tasks t ON tf.task_id = t.id
|
|
10990
|
+
LEFT JOIN agents a ON (tf.agent_id = a.id OR (tf.agent_id IS NULL AND t.assigned_to = a.id))
|
|
10991
|
+
WHERE t.status = 'in_progress'
|
|
10992
|
+
AND tf.status != 'removed'
|
|
10993
|
+
AND t.project_id = ?
|
|
10994
|
+
ORDER BY tf.updated_at DESC
|
|
10995
|
+
`).all(pid);
|
|
10996
|
+
}
|
|
10997
|
+
if (files.length === 0) {
|
|
10998
|
+
return { content: [{ type: "text", text: "No active files \u2014 no in-progress tasks have linked files." }] };
|
|
10999
|
+
}
|
|
11000
|
+
return { content: [{ type: "text", text: JSON.stringify(files, null, 2) }] };
|
|
11001
|
+
} catch (e) {
|
|
11002
|
+
return { content: [{ type: "text", text: formatError(e) }], isError: true };
|
|
11003
|
+
}
|
|
11004
|
+
});
|
|
11005
|
+
}
|
|
10905
11006
|
if (shouldRegisterTool("create_handoff")) {
|
|
10906
11007
|
server.tool("create_handoff", "Create a session handoff note for agent coordination.", {
|
|
10907
11008
|
agent_id: exports_external.string().optional().describe("Agent creating the handoff"),
|
package/dist/server/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __returnValue = (v) => v;
|
|
5
|
+
function __exportSetter(name, newValue) {
|
|
6
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
7
|
+
}
|
|
4
8
|
var __export = (target, all) => {
|
|
5
9
|
for (var name in all)
|
|
6
10
|
__defProp(target, name, {
|
|
7
11
|
get: all[name],
|
|
8
12
|
enumerable: true,
|
|
9
13
|
configurable: true,
|
|
10
|
-
set: (
|
|
14
|
+
set: __exportSetter.bind(all, name)
|
|
11
15
|
});
|
|
12
16
|
};
|
|
13
17
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|