@hasna/todos 0.9.46 → 0.9.47
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 +31 -1
- package/dist/server/index.js +65 -1
- package/dist/server/serve.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4455,6 +4455,14 @@ var init_plans = __esm(() => {
|
|
|
4455
4455
|
});
|
|
4456
4456
|
|
|
4457
4457
|
// src/db/comments.ts
|
|
4458
|
+
var exports_comments = {};
|
|
4459
|
+
__export(exports_comments, {
|
|
4460
|
+
logProgress: () => logProgress,
|
|
4461
|
+
listComments: () => listComments,
|
|
4462
|
+
getComment: () => getComment,
|
|
4463
|
+
deleteComment: () => deleteComment,
|
|
4464
|
+
addComment: () => addComment
|
|
4465
|
+
});
|
|
4458
4466
|
function addComment(input, db) {
|
|
4459
4467
|
const d = db || getDatabase();
|
|
4460
4468
|
if (!getTask(input.task_id, d)) {
|
|
@@ -4482,6 +4490,15 @@ function getComment(id, db) {
|
|
|
4482
4490
|
const d = db || getDatabase();
|
|
4483
4491
|
return d.query("SELECT * FROM task_comments WHERE id = ?").get(id);
|
|
4484
4492
|
}
|
|
4493
|
+
function listComments(taskId, db) {
|
|
4494
|
+
const d = db || getDatabase();
|
|
4495
|
+
return d.query("SELECT * FROM task_comments WHERE task_id = ? ORDER BY created_at").all(taskId);
|
|
4496
|
+
}
|
|
4497
|
+
function deleteComment(id, db) {
|
|
4498
|
+
const d = db || getDatabase();
|
|
4499
|
+
const result = d.run("DELETE FROM task_comments WHERE id = ?", [id]);
|
|
4500
|
+
return result.changes > 0;
|
|
4501
|
+
}
|
|
4485
4502
|
var init_comments = __esm(() => {
|
|
4486
4503
|
init_types();
|
|
4487
4504
|
init_database();
|
|
@@ -11264,7 +11281,8 @@ function taskToSummary(task, fields) {
|
|
|
11264
11281
|
created_at: task.created_at,
|
|
11265
11282
|
updated_at: task.updated_at,
|
|
11266
11283
|
completed_at: task.completed_at,
|
|
11267
|
-
due_at: task.due_at
|
|
11284
|
+
due_at: task.due_at,
|
|
11285
|
+
recurrence_rule: task.recurrence_rule
|
|
11268
11286
|
};
|
|
11269
11287
|
if (!fields || fields.length === 0)
|
|
11270
11288
|
return full;
|
|
@@ -11555,6 +11573,18 @@ data: ${JSON.stringify({ type: "connected", agent_id: agentId, timestamp: new Da
|
|
|
11555
11573
|
return json({ error: e instanceof Error ? e.message : "Failed" }, 500, port);
|
|
11556
11574
|
}
|
|
11557
11575
|
}
|
|
11576
|
+
const progressMatch = path.match(/^\/api\/tasks\/([^/]+)\/progress$/);
|
|
11577
|
+
if (progressMatch && method === "GET") {
|
|
11578
|
+
const id = progressMatch[1];
|
|
11579
|
+
const task = getTask(id);
|
|
11580
|
+
if (!task)
|
|
11581
|
+
return json({ error: "Task not found" }, 404, port);
|
|
11582
|
+
const { listComments: listComments2 } = await Promise.resolve().then(() => (init_comments(), exports_comments));
|
|
11583
|
+
const all = listComments2(id);
|
|
11584
|
+
const progress = all.filter((c) => c.type === "progress");
|
|
11585
|
+
const latest = progress[progress.length - 1] || null;
|
|
11586
|
+
return json({ task_id: id, progress_entries: progress, latest, count: progress.length }, 200, port);
|
|
11587
|
+
}
|
|
11558
11588
|
const taskMatch = path.match(/^\/api\/tasks\/([^/]+)$/);
|
|
11559
11589
|
if (taskMatch) {
|
|
11560
11590
|
const id = taskMatch[1];
|
package/dist/server/index.js
CHANGED
|
@@ -2159,6 +2159,57 @@ var init_agents = __esm(() => {
|
|
|
2159
2159
|
init_database();
|
|
2160
2160
|
});
|
|
2161
2161
|
|
|
2162
|
+
// src/db/comments.ts
|
|
2163
|
+
var exports_comments = {};
|
|
2164
|
+
__export(exports_comments, {
|
|
2165
|
+
logProgress: () => logProgress,
|
|
2166
|
+
listComments: () => listComments,
|
|
2167
|
+
getComment: () => getComment,
|
|
2168
|
+
deleteComment: () => deleteComment,
|
|
2169
|
+
addComment: () => addComment
|
|
2170
|
+
});
|
|
2171
|
+
function addComment(input, db) {
|
|
2172
|
+
const d = db || getDatabase();
|
|
2173
|
+
if (!getTask(input.task_id, d)) {
|
|
2174
|
+
throw new TaskNotFoundError(input.task_id);
|
|
2175
|
+
}
|
|
2176
|
+
const id = uuid();
|
|
2177
|
+
const timestamp = now();
|
|
2178
|
+
d.run(`INSERT INTO task_comments (id, task_id, agent_id, session_id, content, type, progress_pct, created_at)
|
|
2179
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
2180
|
+
id,
|
|
2181
|
+
input.task_id,
|
|
2182
|
+
input.agent_id || null,
|
|
2183
|
+
input.session_id || null,
|
|
2184
|
+
input.content,
|
|
2185
|
+
input.type || "comment",
|
|
2186
|
+
input.progress_pct ?? null,
|
|
2187
|
+
timestamp
|
|
2188
|
+
]);
|
|
2189
|
+
return getComment(id, d);
|
|
2190
|
+
}
|
|
2191
|
+
function logProgress(taskId, message, pct, agentId, db) {
|
|
2192
|
+
return addComment({ task_id: taskId, content: message, type: "progress", progress_pct: pct, agent_id: agentId }, db);
|
|
2193
|
+
}
|
|
2194
|
+
function getComment(id, db) {
|
|
2195
|
+
const d = db || getDatabase();
|
|
2196
|
+
return d.query("SELECT * FROM task_comments WHERE id = ?").get(id);
|
|
2197
|
+
}
|
|
2198
|
+
function listComments(taskId, db) {
|
|
2199
|
+
const d = db || getDatabase();
|
|
2200
|
+
return d.query("SELECT * FROM task_comments WHERE task_id = ? ORDER BY created_at").all(taskId);
|
|
2201
|
+
}
|
|
2202
|
+
function deleteComment(id, db) {
|
|
2203
|
+
const d = db || getDatabase();
|
|
2204
|
+
const result = d.run("DELETE FROM task_comments WHERE id = ?", [id]);
|
|
2205
|
+
return result.changes > 0;
|
|
2206
|
+
}
|
|
2207
|
+
var init_comments = __esm(() => {
|
|
2208
|
+
init_types();
|
|
2209
|
+
init_database();
|
|
2210
|
+
init_tasks();
|
|
2211
|
+
});
|
|
2212
|
+
|
|
2162
2213
|
// src/db/orgs.ts
|
|
2163
2214
|
var exports_orgs = {};
|
|
2164
2215
|
__export(exports_orgs, {
|
|
@@ -2444,7 +2495,8 @@ function taskToSummary(task, fields) {
|
|
|
2444
2495
|
created_at: task.created_at,
|
|
2445
2496
|
updated_at: task.updated_at,
|
|
2446
2497
|
completed_at: task.completed_at,
|
|
2447
|
-
due_at: task.due_at
|
|
2498
|
+
due_at: task.due_at,
|
|
2499
|
+
recurrence_rule: task.recurrence_rule
|
|
2448
2500
|
};
|
|
2449
2501
|
if (!fields || fields.length === 0)
|
|
2450
2502
|
return full;
|
|
@@ -2735,6 +2787,18 @@ data: ${JSON.stringify({ type: "connected", agent_id: agentId, timestamp: new Da
|
|
|
2735
2787
|
return json({ error: e instanceof Error ? e.message : "Failed" }, 500, port);
|
|
2736
2788
|
}
|
|
2737
2789
|
}
|
|
2790
|
+
const progressMatch = path.match(/^\/api\/tasks\/([^/]+)\/progress$/);
|
|
2791
|
+
if (progressMatch && method === "GET") {
|
|
2792
|
+
const id = progressMatch[1];
|
|
2793
|
+
const task = getTask(id);
|
|
2794
|
+
if (!task)
|
|
2795
|
+
return json({ error: "Task not found" }, 404, port);
|
|
2796
|
+
const { listComments: listComments2 } = await Promise.resolve().then(() => (init_comments(), exports_comments));
|
|
2797
|
+
const all = listComments2(id);
|
|
2798
|
+
const progress = all.filter((c) => c.type === "progress");
|
|
2799
|
+
const latest = progress[progress.length - 1] || null;
|
|
2800
|
+
return json({ task_id: id, progress_entries: progress, latest, count: progress.length }, 200, port);
|
|
2801
|
+
}
|
|
2738
2802
|
const taskMatch = path.match(/^\/api\/tasks\/([^/]+)$/);
|
|
2739
2803
|
if (taskMatch) {
|
|
2740
2804
|
const id = taskMatch[1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/server/serve.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/server/serve.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiHH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0uB1G"}
|