@hasna/todos 0.13.10 → 0.13.12
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/assignee-guard.d.ts +8 -1
- package/dist/cli/assignee-guard.d.ts.map +1 -1
- package/dist/cli/cloud-router.d.ts.map +1 -1
- package/dist/cli/commands/query-commands.d.ts.map +1 -1
- package/dist/cli/commands/task-commands.d.ts.map +1 -1
- package/dist/cli/index.js +153 -102
- package/dist/contracts.js +92 -67
- package/dist/db/agent-metrics.d.ts.map +1 -1
- package/dist/db/audit.d.ts.map +1 -1
- package/dist/db/budgets.d.ts.map +1 -1
- package/dist/db/database.d.ts +44 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/handoffs.d.ts.map +1 -1
- package/dist/db/task-crud.d.ts +1 -0
- package/dist/db/task-crud.d.ts.map +1 -1
- package/dist/db/task-files.d.ts.map +1 -1
- package/dist/db/task-lifecycle.d.ts.map +1 -1
- package/dist/db/task-relations.d.ts.map +1 -1
- package/dist/db/task-status.d.ts.map +1 -1
- package/dist/db/webhooks.d.ts.map +1 -1
- package/dist/index.js +119 -85
- package/dist/lib/assignee-validation.d.ts +22 -0
- package/dist/lib/assignee-validation.d.ts.map +1 -1
- package/dist/lib/capacity-forecasts.d.ts.map +1 -1
- package/dist/lib/completion-guard.d.ts.map +1 -1
- package/dist/lib/local-notifications.d.ts.map +1 -1
- package/dist/lib/local-reports.d.ts.map +1 -1
- package/dist/lib/notification-reminders.d.ts.map +1 -1
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/lib/usage-ledger.d.ts.map +1 -1
- package/dist/mcp/index.js +138 -93
- package/dist/mcp/tools/agents.d.ts.map +1 -1
- package/dist/mcp/tools/task-adv-tools.d.ts.map +1 -1
- package/dist/mcp/tools/task-auto-tools.d.ts.map +1 -1
- package/dist/mcp/tools/task-resources.d.ts.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/registry.js +92 -67
- package/dist/release-provenance.json +5 -5
- package/dist/server/index.js +138 -93
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/storage.js +57 -42
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-relations.d.ts","sourceRoot":"","sources":["../../src/db/task-relations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,IAAI,EAEJ,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAClD,MAAM,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,mBAAmB,EAAE,EAC7B,EAAE,CAAC,EAAE,QAAQ,GACZ;IAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QA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,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAcnG"}
|
package/dist/index.js
CHANGED
|
@@ -4103,14 +4103,17 @@ var exports_database = {};
|
|
|
4103
4103
|
__export(exports_database, {
|
|
4104
4104
|
uuid: () => uuid,
|
|
4105
4105
|
resolvePartialId: () => resolvePartialId,
|
|
4106
|
+
resolveAssignedToAliases: () => resolveAssignedToAliases,
|
|
4106
4107
|
resetDatabase: () => resetDatabase,
|
|
4107
4108
|
now: () => now,
|
|
4109
|
+
lowerInClause: () => lowerInClause,
|
|
4108
4110
|
lockExpiryCutoff: () => lockExpiryCutoff,
|
|
4109
4111
|
isLockExpired: () => isLockExpired,
|
|
4110
4112
|
getDatabasePath: () => getDatabasePath,
|
|
4111
4113
|
getDatabase: () => getDatabase,
|
|
4112
4114
|
closeDatabase: () => closeDatabase,
|
|
4113
4115
|
clearExpiredLocks: () => clearExpiredLocks,
|
|
4116
|
+
assignedToAliasSet: () => assignedToAliasSet,
|
|
4114
4117
|
LOCK_EXPIRY_MINUTES: () => LOCK_EXPIRY_MINUTES
|
|
4115
4118
|
});
|
|
4116
4119
|
import { Database } from "bun:sqlite";
|
|
@@ -4339,6 +4342,33 @@ function resolvePartialId(db, table, partialId) {
|
|
|
4339
4342
|
}
|
|
4340
4343
|
return null;
|
|
4341
4344
|
}
|
|
4345
|
+
function resolveAssignedToAliases(db, ref) {
|
|
4346
|
+
const aliases = new Set([ref]);
|
|
4347
|
+
let agentId;
|
|
4348
|
+
try {
|
|
4349
|
+
agentId = resolvePartialId(db, "agents", ref);
|
|
4350
|
+
} catch (err) {
|
|
4351
|
+
if (!(err instanceof IdentityAliasAmbiguousError))
|
|
4352
|
+
throw err;
|
|
4353
|
+
agentId = null;
|
|
4354
|
+
}
|
|
4355
|
+
if (agentId) {
|
|
4356
|
+
aliases.add(agentId);
|
|
4357
|
+
const row = db.query("SELECT name FROM agents WHERE id = ?").get(agentId);
|
|
4358
|
+
if (row?.name)
|
|
4359
|
+
aliases.add(row.name);
|
|
4360
|
+
}
|
|
4361
|
+
return [...aliases];
|
|
4362
|
+
}
|
|
4363
|
+
function assignedToAliasSet(db, ref) {
|
|
4364
|
+
return new Set(resolveAssignedToAliases(db, ref).map((a) => a.toLowerCase()));
|
|
4365
|
+
}
|
|
4366
|
+
function lowerInClause(column, values, params) {
|
|
4367
|
+
if (values.length === 0)
|
|
4368
|
+
return "1=0";
|
|
4369
|
+
params.push(...values.map((v) => v.toLowerCase()));
|
|
4370
|
+
return `LOWER(${column}) IN (${values.map(() => "?").join(",")})`;
|
|
4371
|
+
}
|
|
4342
4372
|
var LOCK_EXPIRY_MINUTES = 30, _db = null, _dbPath = null, ALLOWED_TABLES;
|
|
4343
4373
|
var init_database = __esm(() => {
|
|
4344
4374
|
init_schema();
|
|
@@ -4979,17 +5009,19 @@ function checkCompletionGuard(task, agentId, db, configOverride) {
|
|
|
4979
5009
|
throw new CompletionGuardError(`Too fast: task was started ${Math.floor(elapsedSeconds)}s ago. Minimum work duration is ${config.min_work_seconds}s. Wait ${remaining}s.`, remaining);
|
|
4980
5010
|
}
|
|
4981
5011
|
}
|
|
5012
|
+
const assignedAliasParams = [];
|
|
5013
|
+
const assignedInClause = agent ? lowerInClause("assigned_to", resolveAssignedToAliases(db, agent), assignedAliasParams) : "";
|
|
4982
5014
|
if (agent && config.max_completions_per_window && config.window_minutes) {
|
|
4983
5015
|
const windowStart = new Date(Date.now() - config.window_minutes * 60 * 1000).toISOString();
|
|
4984
5016
|
const result = db.query(`SELECT COUNT(*) as count FROM tasks
|
|
4985
|
-
WHERE completed_at > ? AND (
|
|
5017
|
+
WHERE completed_at > ? AND (${assignedInClause} OR agent_id = ?)`).get(windowStart, ...assignedAliasParams, agent);
|
|
4986
5018
|
if (result.count >= config.max_completions_per_window) {
|
|
4987
5019
|
throw new CompletionGuardError(`Rate limit: ${result.count} tasks completed in the last ${config.window_minutes} minutes (max ${config.max_completions_per_window}). Slow down.`);
|
|
4988
5020
|
}
|
|
4989
5021
|
}
|
|
4990
5022
|
if (agent && config.cooldown_seconds) {
|
|
4991
5023
|
const result = db.query(`SELECT MAX(completed_at) as last_completed FROM tasks
|
|
4992
|
-
WHERE completed_at IS NOT NULL AND (
|
|
5024
|
+
WHERE completed_at IS NOT NULL AND (${assignedInClause} OR agent_id = ?) AND id != ?`).get(...assignedAliasParams, agent, task.id);
|
|
4993
5025
|
if (result.last_completed) {
|
|
4994
5026
|
const elapsedSeconds = (Date.now() - new Date(result.last_completed).getTime()) / 1000;
|
|
4995
5027
|
if (elapsedSeconds < config.cooldown_seconds) {
|
|
@@ -5003,6 +5035,7 @@ var init_completion_guard = __esm(() => {
|
|
|
5003
5035
|
init_types();
|
|
5004
5036
|
init_config2();
|
|
5005
5037
|
init_projects();
|
|
5038
|
+
init_database();
|
|
5006
5039
|
});
|
|
5007
5040
|
|
|
5008
5041
|
// src/lib/event-emission-safety.ts
|
|
@@ -7232,7 +7265,7 @@ function getRecap(hours = 8, projectId, db) {
|
|
|
7232
7265
|
const in_progress = projectId ? d.query(`SELECT id, short_id, title, assigned_to, started_at FROM tasks WHERE status = 'in_progress' AND project_id = ? ORDER BY updated_at DESC`).all(projectId) : d.query(`SELECT id, short_id, title, assigned_to, started_at FROM tasks WHERE status = 'in_progress' ORDER BY updated_at DESC`).all();
|
|
7233
7266
|
const blocked = projectId ? d.query(`SELECT DISTINCT t.id, t.short_id, t.title, t.assigned_to FROM tasks t JOIN task_dependencies td ON td.task_id = t.id JOIN tasks dep ON dep.id = td.depends_on AND dep.status NOT IN ('completed','cancelled') WHERE t.status = 'pending'${tpf}`).all(projectId) : d.query(`SELECT DISTINCT t.id, t.short_id, t.title, t.assigned_to FROM tasks t JOIN task_dependencies td ON td.task_id = t.id JOIN tasks dep ON dep.id = td.depends_on AND dep.status NOT IN ('completed','cancelled') WHERE t.status = 'pending'`).all();
|
|
7234
7267
|
const stale = projectId ? d.query(`SELECT id, short_id, title, assigned_to, updated_at FROM tasks WHERE status = 'in_progress' AND updated_at < ? AND project_id = ? ORDER BY updated_at ASC`).all(staleWindow, projectId) : d.query(`SELECT id, short_id, title, assigned_to, updated_at FROM tasks WHERE status = 'in_progress' AND updated_at < ? ORDER BY updated_at ASC`).all(staleWindow);
|
|
7235
|
-
const agents = projectId ? d.query(`SELECT a.name, a.last_seen_at, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR t.agent_id = a.id) AND t.status = 'completed' AND t.completed_at > ?${tpf}) as completed_count, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR t.agent_id = a.id) AND t.status = 'in_progress'${tpf}) as in_progress_count FROM agents a WHERE a.status = 'active' AND a.last_seen_at > ? ORDER BY completed_count DESC`).all(since, projectId, projectId, since) : d.query(`SELECT a.name, a.last_seen_at, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR t.agent_id = a.id) AND t.status = 'completed' AND t.completed_at > ?) as completed_count, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR t.agent_id = a.id) AND t.status = 'in_progress') as in_progress_count FROM agents a WHERE a.status = 'active' AND a.last_seen_at > ? ORDER BY completed_count DESC`).all(since, since);
|
|
7268
|
+
const agents = projectId ? d.query(`SELECT a.name, a.last_seen_at, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR LOWER(t.assigned_to) = LOWER(a.name) OR t.agent_id = a.id) AND t.status = 'completed' AND t.completed_at > ?${tpf}) as completed_count, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR LOWER(t.assigned_to) = LOWER(a.name) OR t.agent_id = a.id) AND t.status = 'in_progress'${tpf}) as in_progress_count FROM agents a WHERE a.status = 'active' AND a.last_seen_at > ? ORDER BY completed_count DESC`).all(since, projectId, projectId, since) : d.query(`SELECT a.name, a.last_seen_at, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR LOWER(t.assigned_to) = LOWER(a.name) OR t.agent_id = a.id) AND t.status = 'completed' AND t.completed_at > ?) as completed_count, (SELECT COUNT(*) FROM tasks t WHERE (t.assigned_to = a.id OR LOWER(t.assigned_to) = LOWER(a.name) OR t.agent_id = a.id) AND t.status = 'in_progress') as in_progress_count FROM agents a WHERE a.status = 'active' AND a.last_seen_at > ? ORDER BY completed_count DESC`).all(since, since);
|
|
7236
7269
|
return {
|
|
7237
7270
|
hours,
|
|
7238
7271
|
since,
|
|
@@ -7385,13 +7418,17 @@ function logDelivery(d, webhookId, event, payload, statusCode, response, attempt
|
|
|
7385
7418
|
const id = uuid();
|
|
7386
7419
|
d.run(`INSERT INTO webhook_deliveries (id, webhook_id, event, payload, status_code, response, attempt, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [id, webhookId, event, payload, statusCode, response, attempt, now()]);
|
|
7387
7420
|
}
|
|
7388
|
-
function matchesScope(wh, payload) {
|
|
7421
|
+
function matchesScope(wh, payload, db) {
|
|
7389
7422
|
if (wh.project_id && payload.project_id !== wh.project_id)
|
|
7390
7423
|
return false;
|
|
7391
7424
|
if (wh.task_list_id && payload.task_list_id !== wh.task_list_id)
|
|
7392
7425
|
return false;
|
|
7393
|
-
if (wh.agent_id && payload.agent_id !== wh.agent_id
|
|
7394
|
-
|
|
7426
|
+
if (wh.agent_id && payload.agent_id !== wh.agent_id) {
|
|
7427
|
+
const aliasSet = assignedToAliasSet(db, wh.agent_id);
|
|
7428
|
+
const assignedTo = typeof payload.assigned_to === "string" ? payload.assigned_to.toLowerCase() : "";
|
|
7429
|
+
if (!aliasSet.has(assignedTo))
|
|
7430
|
+
return false;
|
|
7431
|
+
}
|
|
7395
7432
|
if (wh.task_id && payload.id !== wh.task_id)
|
|
7396
7433
|
return false;
|
|
7397
7434
|
return true;
|
|
@@ -7458,7 +7495,7 @@ async function dispatchWebhook2(event, payload, db) {
|
|
|
7458
7495
|
const webhooks = listWebhooks(d).filter((w) => w.active && (w.events.length === 0 || w.events.includes(event)));
|
|
7459
7496
|
const payloadObj = typeof payload === "object" && payload !== null ? payload : {};
|
|
7460
7497
|
for (const wh of webhooks) {
|
|
7461
|
-
if (!matchesScope(wh, payloadObj))
|
|
7498
|
+
if (!matchesScope(wh, payloadObj, d))
|
|
7462
7499
|
continue;
|
|
7463
7500
|
const body = JSON.stringify({ event, payload, timestamp: now() });
|
|
7464
7501
|
deliverWebhook(wh, event, body, 1, d).catch((err) => {
|
|
@@ -8561,14 +8598,16 @@ function getNextTask(agentId, filters, db) {
|
|
|
8561
8598
|
conditions.push("id NOT IN (SELECT td.task_id FROM task_dependencies td JOIN tasks dep ON dep.id = td.depends_on WHERE dep.status != 'completed')");
|
|
8562
8599
|
const where = conditions.join(" AND ");
|
|
8563
8600
|
let recentProjectIds = [];
|
|
8601
|
+
const assignedAliasParams = [];
|
|
8602
|
+
const assignedInClause = agentId ? lowerInClause("assigned_to", resolveAssignedToAliases(d, agentId), assignedAliasParams) : "";
|
|
8564
8603
|
if (agentId) {
|
|
8565
|
-
const recentRows = d.query(`SELECT DISTINCT project_id FROM tasks WHERE
|
|
8604
|
+
const recentRows = d.query(`SELECT DISTINCT project_id FROM tasks WHERE ${assignedInClause} AND status = 'completed' AND project_id IS NOT NULL ORDER BY completed_at DESC LIMIT 3`).all(...assignedAliasParams);
|
|
8566
8605
|
recentProjectIds = recentRows.map((r) => r.project_id);
|
|
8567
8606
|
}
|
|
8568
8607
|
let sql = `SELECT * FROM tasks WHERE ${where} ORDER BY `;
|
|
8569
8608
|
if (agentId) {
|
|
8570
|
-
sql += `CASE WHEN
|
|
8571
|
-
params.push(
|
|
8609
|
+
sql += `CASE WHEN ${assignedInClause} THEN 0 WHEN assigned_to IS NULL THEN 1 ELSE 2 END, `;
|
|
8610
|
+
params.push(...assignedAliasParams);
|
|
8572
8611
|
}
|
|
8573
8612
|
if (recentProjectIds.length > 0) {
|
|
8574
8613
|
const placeholders = recentProjectIds.map(() => "?").join(",");
|
|
@@ -8962,30 +9001,6 @@ function getTaskWithRelations(id, db) {
|
|
|
8962
9001
|
checklist
|
|
8963
9002
|
};
|
|
8964
9003
|
}
|
|
8965
|
-
function resolveAssignedToAliases(db, ref) {
|
|
8966
|
-
const aliases = new Set([ref]);
|
|
8967
|
-
let agentId;
|
|
8968
|
-
try {
|
|
8969
|
-
agentId = resolvePartialId(db, "agents", ref);
|
|
8970
|
-
} catch (err) {
|
|
8971
|
-
if (!(err instanceof IdentityAliasAmbiguousError))
|
|
8972
|
-
throw err;
|
|
8973
|
-
agentId = null;
|
|
8974
|
-
}
|
|
8975
|
-
if (agentId) {
|
|
8976
|
-
aliases.add(agentId);
|
|
8977
|
-
const row = db.query("SELECT name FROM agents WHERE id = ?").get(agentId);
|
|
8978
|
-
if (row?.name)
|
|
8979
|
-
aliases.add(row.name);
|
|
8980
|
-
}
|
|
8981
|
-
return [...aliases];
|
|
8982
|
-
}
|
|
8983
|
-
function lowerInClause(column, values, params) {
|
|
8984
|
-
if (values.length === 0)
|
|
8985
|
-
return "1=0";
|
|
8986
|
-
params.push(...values.map((v) => v.toLowerCase()));
|
|
8987
|
-
return `LOWER(${column}) IN (${values.map(() => "?").join(",")})`;
|
|
8988
|
-
}
|
|
8989
9004
|
function listTasks(filter = {}, db) {
|
|
8990
9005
|
const d = db || getDatabase();
|
|
8991
9006
|
const { clearExpiredLocks: clearExpiredLocks2 } = (init_database(), __toCommonJS(exports_database));
|
|
@@ -9458,6 +9473,7 @@ function deleteTask(id, db) {
|
|
|
9458
9473
|
var init_task_crud = __esm(() => {
|
|
9459
9474
|
init_types();
|
|
9460
9475
|
init_database();
|
|
9476
|
+
init_database();
|
|
9461
9477
|
init_completion_guard();
|
|
9462
9478
|
init_event_emission_safety();
|
|
9463
9479
|
init_event_hooks();
|
|
@@ -9620,8 +9636,8 @@ function getTaskStats(filters, db) {
|
|
|
9620
9636
|
params.push(filters.task_list_id);
|
|
9621
9637
|
}
|
|
9622
9638
|
if (filters?.agent_id) {
|
|
9623
|
-
|
|
9624
|
-
|
|
9639
|
+
params.push(filters.agent_id);
|
|
9640
|
+
conditions.push(`(agent_id = ? OR ${lowerInClause("assigned_to", resolveAssignedToAliases(d, filters.agent_id), params)})`);
|
|
9625
9641
|
}
|
|
9626
9642
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
9627
9643
|
const totalRow = d.query(`SELECT COUNT(*) as count FROM tasks ${where}`).get(...params);
|
|
@@ -9757,8 +9773,7 @@ function getEscalatedTasks(opts = {}, db, at = new Date) {
|
|
|
9757
9773
|
params.push(opts.project_id);
|
|
9758
9774
|
}
|
|
9759
9775
|
if (opts.agent_id) {
|
|
9760
|
-
conditions.push("assigned_to
|
|
9761
|
-
params.push(opts.agent_id);
|
|
9776
|
+
conditions.push(lowerInClause("assigned_to", resolveAssignedToAliases(d, opts.agent_id), params));
|
|
9762
9777
|
}
|
|
9763
9778
|
const rows = d.query(`SELECT * FROM tasks WHERE ${conditions.join(" AND ")} ORDER BY due_at ASC, created_at ASC`).all(...params);
|
|
9764
9779
|
return rows.map(rowToTask).map((task) => {
|
|
@@ -9991,13 +10006,14 @@ function getTimeReport(opts, db) {
|
|
|
9991
10006
|
params.push(opts.plan_id);
|
|
9992
10007
|
}
|
|
9993
10008
|
if (opts?.agent_id) {
|
|
10009
|
+
const assignedInClause = lowerInClause("t.assigned_to", resolveAssignedToAliases(d, opts.agent_id), params);
|
|
9994
10010
|
conditions.push(`(
|
|
9995
|
-
|
|
10011
|
+
${assignedInClause}
|
|
9996
10012
|
OR t.agent_id = ?
|
|
9997
10013
|
OR EXISTS (SELECT 1 FROM task_time_logs ttl WHERE ttl.task_id = t.id AND ttl.agent_id = ?)
|
|
9998
10014
|
OR EXISTS (SELECT 1 FROM focus_sessions fs WHERE fs.task_id = t.id AND fs.agent_id = ?)
|
|
9999
10015
|
)`);
|
|
10000
|
-
params.push(opts.agent_id, opts.agent_id, opts.agent_id
|
|
10016
|
+
params.push(opts.agent_id, opts.agent_id, opts.agent_id);
|
|
10001
10017
|
}
|
|
10002
10018
|
if (opts?.since) {
|
|
10003
10019
|
conditions.push("(t.completed_at >= ? OR t.updated_at >= ?)");
|
|
@@ -12122,7 +12138,7 @@ var init_dispatches = __esm(() => {
|
|
|
12122
12138
|
// package.json
|
|
12123
12139
|
var package_default = {
|
|
12124
12140
|
name: "@hasna/todos",
|
|
12125
|
-
version: "0.13.
|
|
12141
|
+
version: "0.13.12",
|
|
12126
12142
|
description: "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
|
|
12127
12143
|
type: "module",
|
|
12128
12144
|
main: "dist/index.js",
|
|
@@ -22134,11 +22150,12 @@ function runAlerts(input, db, checkedAt, quieted) {
|
|
|
22134
22150
|
if (input.include_runs === false)
|
|
22135
22151
|
return [];
|
|
22136
22152
|
const since = Date.parse(input.run_since || new Date(Date.parse(checkedAt) - 24 * 60 * 60000).toISOString());
|
|
22153
|
+
const runAlertAliases = input.agent_id ? assignedToAliasSet(db, input.agent_id) : null;
|
|
22137
22154
|
return listTaskRuns(undefined, db).filter((run) => run.completed_at && Date.parse(run.completed_at) >= since).map((run) => {
|
|
22138
22155
|
const task2 = getTask(run.task_id, db);
|
|
22139
22156
|
if (input.project_id && task2?.project_id !== input.project_id)
|
|
22140
22157
|
return null;
|
|
22141
|
-
if (input.agent_id && run.agent_id !== input.agent_id && task2?.assigned_to
|
|
22158
|
+
if (input.agent_id && run.agent_id !== input.agent_id && !(runAlertAliases && runAlertAliases.has((task2?.assigned_to ?? "").toLowerCase())))
|
|
22142
22159
|
return null;
|
|
22143
22160
|
const failed = ["failed", "cancelled"].includes(run.status);
|
|
22144
22161
|
return {
|
|
@@ -22183,6 +22200,7 @@ async function checkLocalNotifications(input = {}, db) {
|
|
|
22183
22200
|
const warnings = [];
|
|
22184
22201
|
if (Number.isNaN(checkedMs))
|
|
22185
22202
|
warnings.push("Invalid check timestamp; due-soon window may be incomplete.");
|
|
22203
|
+
const notifyAgentAliases = input.agent_id ? assignedToAliasSet(d, input.agent_id) : null;
|
|
22186
22204
|
const alerts = [];
|
|
22187
22205
|
for (const escalation of getEscalatedTasks({ project_id: input.project_id, agent_id: input.agent_id }, d, new Date(checkedAt))) {
|
|
22188
22206
|
for (const reason of escalation.reasons) {
|
|
@@ -22194,7 +22212,7 @@ async function checkLocalNotifications(input = {}, db) {
|
|
|
22194
22212
|
for (const task2 of listTasks({ project_id: input.project_id, include_archived: false, limit: 5000 }, d)) {
|
|
22195
22213
|
if (!unfinished(task2) || !task2.due_at)
|
|
22196
22214
|
continue;
|
|
22197
|
-
if (input.agent_id && task2.
|
|
22215
|
+
if (input.agent_id && task2.agent_id !== input.agent_id && !(notifyAgentAliases && notifyAgentAliases.has((task2.assigned_to ?? "").toLowerCase())))
|
|
22198
22216
|
continue;
|
|
22199
22217
|
if (task2.due_at > checkedAt && task2.due_at <= dueSoonUntil) {
|
|
22200
22218
|
alerts.push(taskAlert(task2, "task_due_soon", "task.due_soon", "warning", `Due soon: ${task2.title}`, task2.due_at, quieted));
|
|
@@ -22202,7 +22220,7 @@ async function checkLocalNotifications(input = {}, db) {
|
|
|
22202
22220
|
}
|
|
22203
22221
|
}
|
|
22204
22222
|
for (const task2 of getStaleTasks(staleMinutes, { project_id: input.project_id }, d)) {
|
|
22205
|
-
if (input.agent_id && task2.
|
|
22223
|
+
if (input.agent_id && task2.agent_id !== input.agent_id && !(notifyAgentAliases && notifyAgentAliases.has((task2.assigned_to ?? "").toLowerCase())))
|
|
22206
22224
|
continue;
|
|
22207
22225
|
alerts.push(taskAlert(task2, "task_stale", "task.stale", "warning", `Stale task: ${task2.title}`, checkedAt, quieted, { stale_minutes: staleMinutes }));
|
|
22208
22226
|
}
|
|
@@ -22330,14 +22348,15 @@ function millisBetween(start, end) {
|
|
|
22330
22348
|
return 0;
|
|
22331
22349
|
return endMs - startMs;
|
|
22332
22350
|
}
|
|
22333
|
-
function addTaskScope(where, params, options, alias = "t") {
|
|
22351
|
+
function addTaskScope(where, params, options, db, alias = "t") {
|
|
22334
22352
|
if (options.project_id) {
|
|
22335
22353
|
where.push(`${alias}.project_id = ?`);
|
|
22336
22354
|
params.push(options.project_id);
|
|
22337
22355
|
}
|
|
22338
22356
|
if (options.agent_id) {
|
|
22339
|
-
|
|
22340
|
-
|
|
22357
|
+
params.push(options.agent_id);
|
|
22358
|
+
const assignedInClause = lowerInClause(`${alias}.assigned_to`, resolveAssignedToAliases(db, options.agent_id), params);
|
|
22359
|
+
where.push(`(${alias}.agent_id = ? OR ${assignedInClause})`);
|
|
22341
22360
|
}
|
|
22342
22361
|
if (options.since) {
|
|
22343
22362
|
where.push(`${alias}.created_at >= ?`);
|
|
@@ -22348,14 +22367,15 @@ function addTaskScope(where, params, options, alias = "t") {
|
|
|
22348
22367
|
params.push(options.until);
|
|
22349
22368
|
}
|
|
22350
22369
|
}
|
|
22351
|
-
function addRunScope(where, params, options, runAlias = "r", taskAlias = "t") {
|
|
22370
|
+
function addRunScope(where, params, options, db, runAlias = "r", taskAlias = "t") {
|
|
22352
22371
|
if (options.project_id) {
|
|
22353
22372
|
where.push(`${taskAlias}.project_id = ?`);
|
|
22354
22373
|
params.push(options.project_id);
|
|
22355
22374
|
}
|
|
22356
22375
|
if (options.agent_id) {
|
|
22357
|
-
|
|
22358
|
-
|
|
22376
|
+
params.push(options.agent_id, options.agent_id);
|
|
22377
|
+
const assignedInClause = lowerInClause(`${taskAlias}.assigned_to`, resolveAssignedToAliases(db, options.agent_id), params);
|
|
22378
|
+
where.push(`(${runAlias}.agent_id = ? OR ${taskAlias}.agent_id = ? OR ${assignedInClause})`);
|
|
22359
22379
|
}
|
|
22360
22380
|
if (options.since) {
|
|
22361
22381
|
where.push(`${runAlias}.started_at >= ?`);
|
|
@@ -22366,14 +22386,15 @@ function addRunScope(where, params, options, runAlias = "r", taskAlias = "t") {
|
|
|
22366
22386
|
params.push(options.until);
|
|
22367
22387
|
}
|
|
22368
22388
|
}
|
|
22369
|
-
function addTraceScope(where, params, options, traceAlias = "tr", taskAlias = "t") {
|
|
22389
|
+
function addTraceScope(where, params, options, db, traceAlias = "tr", taskAlias = "t") {
|
|
22370
22390
|
if (options.project_id) {
|
|
22371
22391
|
where.push(`${taskAlias}.project_id = ?`);
|
|
22372
22392
|
params.push(options.project_id);
|
|
22373
22393
|
}
|
|
22374
22394
|
if (options.agent_id) {
|
|
22375
|
-
|
|
22376
|
-
|
|
22395
|
+
params.push(options.agent_id, options.agent_id);
|
|
22396
|
+
const assignedInClause = lowerInClause(`${taskAlias}.assigned_to`, resolveAssignedToAliases(db, options.agent_id), params);
|
|
22397
|
+
where.push(`(${traceAlias}.agent_id = ? OR ${taskAlias}.agent_id = ? OR ${assignedInClause})`);
|
|
22377
22398
|
}
|
|
22378
22399
|
if (options.since) {
|
|
22379
22400
|
where.push(`${traceAlias}.created_at >= ?`);
|
|
@@ -22433,7 +22454,7 @@ function createLocalUsageLedger(options = {}, db) {
|
|
|
22433
22454
|
const generatedAt = options.generated_at || new Date().toISOString();
|
|
22434
22455
|
const taskWhere = [];
|
|
22435
22456
|
const taskParams = [];
|
|
22436
|
-
addTaskScope(taskWhere, taskParams, options);
|
|
22457
|
+
addTaskScope(taskWhere, taskParams, options, d);
|
|
22437
22458
|
const taskClause = taskWhere.length ? `WHERE ${taskWhere.join(" AND ")}` : "";
|
|
22438
22459
|
const taskTotals = queryOne(d, `SELECT COUNT(*) as tasks, COALESCE(SUM(cost_tokens), 0) as task_tokens, COALESCE(SUM(cost_usd), 0) as task_cost_usd FROM tasks t ${taskClause}`, taskParams);
|
|
22439
22460
|
let projectCount = 0;
|
|
@@ -22442,14 +22463,14 @@ function createLocalUsageLedger(options = {}, db) {
|
|
|
22442
22463
|
} else if (options.agent_id) {
|
|
22443
22464
|
const projectWhere = ["t.project_id IS NOT NULL"];
|
|
22444
22465
|
const projectParams = [];
|
|
22445
|
-
addTaskScope(projectWhere, projectParams, options);
|
|
22466
|
+
addTaskScope(projectWhere, projectParams, options, d);
|
|
22446
22467
|
projectCount = queryOne(d, `SELECT COUNT(DISTINCT t.project_id) as count FROM tasks t WHERE ${projectWhere.join(" AND ")}`, projectParams).count;
|
|
22447
22468
|
} else {
|
|
22448
22469
|
projectCount = queryOne(d, "SELECT COUNT(*) as count FROM projects", []).count;
|
|
22449
22470
|
}
|
|
22450
22471
|
const runWhere = [];
|
|
22451
22472
|
const runParams = [];
|
|
22452
|
-
addRunScope(runWhere, runParams, options);
|
|
22473
|
+
addRunScope(runWhere, runParams, options, d);
|
|
22453
22474
|
const runClause = runWhere.length ? `WHERE ${runWhere.join(" AND ")}` : "";
|
|
22454
22475
|
const runs = queryAll(d, `SELECT r.id, r.started_at, r.completed_at, r.metadata
|
|
22455
22476
|
FROM task_runs r JOIN tasks t ON t.id = r.task_id
|
|
@@ -22466,7 +22487,7 @@ function createLocalUsageLedger(options = {}, db) {
|
|
|
22466
22487
|
${runClause}`, runParams);
|
|
22467
22488
|
const traceWhere = [];
|
|
22468
22489
|
const traceParams = [];
|
|
22469
|
-
addTraceScope(traceWhere, traceParams, options);
|
|
22490
|
+
addTraceScope(traceWhere, traceParams, options, d);
|
|
22470
22491
|
const traceClause = traceWhere.length ? `WHERE ${traceWhere.join(" AND ")}` : "";
|
|
22471
22492
|
const traceTotals = queryOne(d, `SELECT COUNT(*) as traces,
|
|
22472
22493
|
COALESCE(SUM(tr.tokens), 0) as tokens,
|
|
@@ -22598,7 +22619,6 @@ function renderLocalUsageLedgerMarkdown(report) {
|
|
|
22598
22619
|
}
|
|
22599
22620
|
// src/lib/local-reports.ts
|
|
22600
22621
|
init_database();
|
|
22601
|
-
init_database();
|
|
22602
22622
|
init_plans();
|
|
22603
22623
|
init_tasks();
|
|
22604
22624
|
var LOCAL_REPORT_SCHEMA_VERSION = 1;
|
|
@@ -22621,10 +22641,12 @@ function limitValue(value) {
|
|
|
22621
22641
|
function isTerminal(task2) {
|
|
22622
22642
|
return task2.status === "completed" || task2.status === "failed" || task2.status === "cancelled";
|
|
22623
22643
|
}
|
|
22624
|
-
function sameAgent(task2, agentId) {
|
|
22644
|
+
function sameAgent(task2, agentId, aliasSet) {
|
|
22625
22645
|
if (!agentId)
|
|
22626
22646
|
return true;
|
|
22627
|
-
|
|
22647
|
+
if (task2.agent_id === agentId)
|
|
22648
|
+
return true;
|
|
22649
|
+
return aliasSet ? aliasSet.has((task2.assigned_to ?? "").toLowerCase()) : task2.assigned_to === agentId;
|
|
22628
22650
|
}
|
|
22629
22651
|
function withinTaskWindow(task2, options) {
|
|
22630
22652
|
const time = Date.parse(task2.updated_at);
|
|
@@ -22637,11 +22659,12 @@ function withinTaskWindow(task2, options) {
|
|
|
22637
22659
|
return true;
|
|
22638
22660
|
}
|
|
22639
22661
|
function scopedTasks(options, db) {
|
|
22662
|
+
const aliasSet = options.agent_id ? assignedToAliasSet(db, options.agent_id) : undefined;
|
|
22640
22663
|
return listTasks({
|
|
22641
22664
|
project_id: options.project_id,
|
|
22642
22665
|
plan_id: options.plan_id,
|
|
22643
22666
|
include_archived: false
|
|
22644
|
-
}, db).filter((task2) => sameAgent(task2, options.agent_id) && withinTaskWindow(task2, options));
|
|
22667
|
+
}, db).filter((task2) => sameAgent(task2, options.agent_id, aliasSet) && withinTaskWindow(task2, options));
|
|
22645
22668
|
}
|
|
22646
22669
|
function summarizeTask(task2) {
|
|
22647
22670
|
return {
|
|
@@ -22707,7 +22730,7 @@ function initialAgentSummary(agentId) {
|
|
|
22707
22730
|
}
|
|
22708
22731
|
};
|
|
22709
22732
|
}
|
|
22710
|
-
function addScopeClauses(where, params, options, timeColumn) {
|
|
22733
|
+
function addScopeClauses(where, params, options, timeColumn, db) {
|
|
22711
22734
|
if (options.project_id) {
|
|
22712
22735
|
where.push("t.project_id = ?");
|
|
22713
22736
|
params.push(options.project_id);
|
|
@@ -22717,8 +22740,9 @@ function addScopeClauses(where, params, options, timeColumn) {
|
|
|
22717
22740
|
params.push(options.plan_id);
|
|
22718
22741
|
}
|
|
22719
22742
|
if (options.agent_id) {
|
|
22720
|
-
|
|
22721
|
-
|
|
22743
|
+
params.push(options.agent_id, options.agent_id);
|
|
22744
|
+
const assignedInClause = lowerInClause("t.assigned_to", resolveAssignedToAliases(db, options.agent_id), params);
|
|
22745
|
+
where.push(`(r.agent_id = ? OR t.agent_id = ? OR ${assignedInClause})`);
|
|
22722
22746
|
}
|
|
22723
22747
|
if (options.since) {
|
|
22724
22748
|
where.push(`${timeColumn} >= ?`);
|
|
@@ -22732,7 +22756,7 @@ function addScopeClauses(where, params, options, timeColumn) {
|
|
|
22732
22756
|
function loadRuns(options, db) {
|
|
22733
22757
|
const where = ["t.archived_at IS NULL"];
|
|
22734
22758
|
const params = [];
|
|
22735
|
-
addScopeClauses(where, params, options, "r.started_at");
|
|
22759
|
+
addScopeClauses(where, params, options, "r.started_at", db);
|
|
22736
22760
|
return db.query(`
|
|
22737
22761
|
SELECT
|
|
22738
22762
|
r.id,
|
|
@@ -22772,8 +22796,9 @@ function loadVerifications(options, db) {
|
|
|
22772
22796
|
params.push(options.plan_id);
|
|
22773
22797
|
}
|
|
22774
22798
|
if (options.agent_id) {
|
|
22775
|
-
|
|
22776
|
-
|
|
22799
|
+
params.push(options.agent_id, options.agent_id);
|
|
22800
|
+
const assignedInClause = lowerInClause("t.assigned_to", resolveAssignedToAliases(db, options.agent_id), params);
|
|
22801
|
+
where.push(`(v.agent_id = ? OR t.agent_id = ? OR ${assignedInClause})`);
|
|
22777
22802
|
}
|
|
22778
22803
|
if (options.since) {
|
|
22779
22804
|
where.push("v.run_at >= ?");
|
|
@@ -23955,8 +23980,7 @@ function searchTasks(options, projectId, taskListId, db) {
|
|
|
23955
23980
|
}
|
|
23956
23981
|
}
|
|
23957
23982
|
if (opts.assigned_to) {
|
|
23958
|
-
sql +=
|
|
23959
|
-
params.push(opts.assigned_to);
|
|
23983
|
+
sql += ` AND ${lowerInClause("t.assigned_to", resolveAssignedToAliases(d, opts.assigned_to), params)}`;
|
|
23960
23984
|
}
|
|
23961
23985
|
if (opts.agent_id) {
|
|
23962
23986
|
sql += " AND t.agent_id = ?";
|
|
@@ -34947,8 +34971,10 @@ function getLatestHandoff(agentId, projectId, db) {
|
|
|
34947
34971
|
function createSessionRecoveryHandoff(input, db) {
|
|
34948
34972
|
const d = db || getDatabase();
|
|
34949
34973
|
const limit = input.limit || 20;
|
|
34950
|
-
const
|
|
34951
|
-
const
|
|
34974
|
+
const params = [];
|
|
34975
|
+
const assignedInClause = lowerInClause("assigned_to", resolveAssignedToAliases(d, input.agent_id), params);
|
|
34976
|
+
const conditions = ["status = 'in_progress'", `(${assignedInClause} OR agent_id = ? OR locked_by = ?)`];
|
|
34977
|
+
params.push(input.agent_id, input.agent_id);
|
|
34952
34978
|
if (input.session_id) {
|
|
34953
34979
|
conditions.push("session_id = ?");
|
|
34954
34980
|
params.push(input.session_id);
|
|
@@ -41630,8 +41656,7 @@ function getUpcomingDueTasks(filters = {}, db) {
|
|
|
41630
41656
|
params.push(filters.project_id);
|
|
41631
41657
|
}
|
|
41632
41658
|
if (filters.agent_id) {
|
|
41633
|
-
query +=
|
|
41634
|
-
params.push(filters.agent_id);
|
|
41659
|
+
query += ` AND ${lowerInClause("assigned_to", resolveAssignedToAliases(d, filters.agent_id), params)}`;
|
|
41635
41660
|
}
|
|
41636
41661
|
query += " ORDER BY due_at ASC";
|
|
41637
41662
|
const rows = d.query(query).all(...params);
|
|
@@ -41674,8 +41699,9 @@ function scanDueDateReminders(prefs, filters, d) {
|
|
|
41674
41699
|
updated++;
|
|
41675
41700
|
reminders.push(result.reminder);
|
|
41676
41701
|
}
|
|
41702
|
+
const overdueAliases = filters.agent_id ? assignedToAliasSet(d, filters.agent_id) : null;
|
|
41677
41703
|
const overdue = getOverdueTasks(filters.project_id, d).filter((t) => {
|
|
41678
|
-
if (
|
|
41704
|
+
if (overdueAliases && !overdueAliases.has((t.assigned_to ?? "").toLowerCase()))
|
|
41679
41705
|
return false;
|
|
41680
41706
|
return true;
|
|
41681
41707
|
});
|
|
@@ -47635,27 +47661,29 @@ function getAgentMetrics(agentId, opts, db) {
|
|
|
47635
47661
|
const agent = d.query("SELECT id, name FROM agents WHERE id = ? OR LOWER(name) = LOWER(?)").get(agentId, agentId);
|
|
47636
47662
|
if (!agent)
|
|
47637
47663
|
return null;
|
|
47664
|
+
const assignedAliases = resolveAssignedToAliases(d, agent.id).map((a) => a.toLowerCase());
|
|
47665
|
+
const assignedInClause = `LOWER(assigned_to) IN (${assignedAliases.map(() => "?").join(",")})`;
|
|
47638
47666
|
let projectFilter2 = "";
|
|
47639
|
-
const params = [agent.id,
|
|
47667
|
+
const params = [agent.id, ...assignedAliases];
|
|
47640
47668
|
if (opts?.project_id) {
|
|
47641
47669
|
projectFilter2 = " AND project_id = ?";
|
|
47642
47670
|
params.push(opts.project_id);
|
|
47643
47671
|
}
|
|
47644
|
-
const completed = d.query(`SELECT COUNT(*) as count FROM tasks WHERE (agent_id = ? OR
|
|
47645
|
-
const failed = d.query(`SELECT COUNT(*) as count FROM tasks WHERE (agent_id = ? OR
|
|
47646
|
-
const inProgress = d.query(`SELECT COUNT(*) as count FROM tasks WHERE (agent_id = ? OR
|
|
47672
|
+
const completed = d.query(`SELECT COUNT(*) as count FROM tasks WHERE (agent_id = ? OR ${assignedInClause}) AND status = 'completed'${projectFilter2}`).get(...params).count;
|
|
47673
|
+
const failed = d.query(`SELECT COUNT(*) as count FROM tasks WHERE (agent_id = ? OR ${assignedInClause}) AND status = 'failed'${projectFilter2}`).get(...params).count;
|
|
47674
|
+
const inProgress = d.query(`SELECT COUNT(*) as count FROM tasks WHERE (agent_id = ? OR ${assignedInClause}) AND status = 'in_progress'${projectFilter2}`).get(...params).count;
|
|
47647
47675
|
const total = completed + failed;
|
|
47648
47676
|
const completionRate = total > 0 ? completed / total : 0;
|
|
47649
47677
|
const avgTime = d.query(`SELECT AVG(
|
|
47650
47678
|
(julianday(completed_at) - julianday(created_at)) * 24 * 60
|
|
47651
47679
|
) as avg_minutes
|
|
47652
47680
|
FROM tasks
|
|
47653
|
-
WHERE (agent_id = ? OR
|
|
47681
|
+
WHERE (agent_id = ? OR ${assignedInClause}) AND status = 'completed' AND completed_at IS NOT NULL${projectFilter2}`).get(...params);
|
|
47654
47682
|
const avgConf = d.query(`SELECT AVG(confidence) as avg_confidence
|
|
47655
47683
|
FROM tasks
|
|
47656
|
-
WHERE (agent_id = ? OR
|
|
47684
|
+
WHERE (agent_id = ? OR ${assignedInClause}) AND status = 'completed' AND confidence IS NOT NULL${projectFilter2}`).get(...params);
|
|
47657
47685
|
const reviewTasks = d.query(`SELECT metadata FROM tasks
|
|
47658
|
-
WHERE (agent_id = ? OR
|
|
47686
|
+
WHERE (agent_id = ? OR ${assignedInClause}) AND status = 'completed'${projectFilter2}
|
|
47659
47687
|
AND metadata LIKE '%_review_score%'`).all(...params);
|
|
47660
47688
|
let reviewScoreAvg = null;
|
|
47661
47689
|
if (reviewTasks.length > 0) {
|
|
@@ -49524,7 +49552,9 @@ function checkBudget(agentId, db) {
|
|
|
49524
49552
|
}
|
|
49525
49553
|
if (budget.max_cost_usd != null) {
|
|
49526
49554
|
const periodStart = new Date(Date.now() - budget.period_hours * 60 * 60 * 1000).toISOString();
|
|
49527
|
-
const
|
|
49555
|
+
const costParams = [];
|
|
49556
|
+
const assignedInClause = lowerInClause("assigned_to", resolveAssignedToAliases(d, agentId), costParams);
|
|
49557
|
+
const costRow = d.query(`SELECT COALESCE(SUM(cost_usd), 0) as total FROM tasks WHERE (${assignedInClause} OR agent_id = ?) AND updated_at > ?`).get(...costParams, agentId, periodStart);
|
|
49528
49558
|
if (costRow.total >= budget.max_cost_usd) {
|
|
49529
49559
|
return { allowed: false, reason: `Cost limit reached ($${costRow.total.toFixed(2)}/$${budget.max_cost_usd.toFixed(2)} in ${budget.period_hours}h)`, current_concurrent: concurrent, max_concurrent: budget.max_concurrent, current_cost_usd: costRow.total, max_cost_usd: budget.max_cost_usd };
|
|
49530
49560
|
}
|
|
@@ -52350,6 +52380,7 @@ function runTodosDoctor(options = {}) {
|
|
|
52350
52380
|
};
|
|
52351
52381
|
}
|
|
52352
52382
|
// src/lib/capacity-forecasts.ts
|
|
52383
|
+
init_database();
|
|
52353
52384
|
init_tasks();
|
|
52354
52385
|
init_task_relations();
|
|
52355
52386
|
init_config2();
|
|
@@ -52393,10 +52424,12 @@ function matchesProfile(profile, query) {
|
|
|
52393
52424
|
return false;
|
|
52394
52425
|
return true;
|
|
52395
52426
|
}
|
|
52396
|
-
function taskMatchesAgent(task2, agentId) {
|
|
52427
|
+
function taskMatchesAgent(task2, agentId, aliasSet) {
|
|
52397
52428
|
if (!agentId)
|
|
52398
52429
|
return true;
|
|
52399
|
-
|
|
52430
|
+
if (task2.agent_id === agentId)
|
|
52431
|
+
return true;
|
|
52432
|
+
return aliasSet ? aliasSet.has((task2.assigned_to ?? "").toLowerCase()) : task2.assigned_to === agentId;
|
|
52400
52433
|
}
|
|
52401
52434
|
function estimateRemaining(task2) {
|
|
52402
52435
|
if (task2.status === "completed" || task2.status === "cancelled")
|
|
@@ -52466,7 +52499,8 @@ function removeCapacityProfile(idOrAgent, projectId) {
|
|
|
52466
52499
|
}
|
|
52467
52500
|
function getPlanningForecast(input = {}, db) {
|
|
52468
52501
|
const startDate = input.start_date ? dateOnly(input.start_date) : todayIso();
|
|
52469
|
-
const
|
|
52502
|
+
const aliasSet = input.agent_id ? assignedToAliasSet(db || getDatabase(), input.agent_id) : undefined;
|
|
52503
|
+
const tasks = listTasks({ project_id: input.project_id, plan_id: input.plan_id, limit: 1e4 }, db).filter((task2) => taskMatchesAgent(task2, input.agent_id, aliasSet));
|
|
52470
52504
|
const reportByTask = new Map(getTimeReport({ project_id: input.project_id, plan_id: input.plan_id, agent_id: input.agent_id, include_open: true }, db).map((entry2) => [entry2.task_id, entry2]));
|
|
52471
52505
|
const profiles = listCapacityProfiles({ agent_id: input.agent_id, project_id: input.project_id });
|
|
52472
52506
|
const globalProfiles = input.project_id ? listCapacityProfiles({ agent_id: input.agent_id }).filter((profile) => profile.project_id === null) : [];
|
|
@@ -10,6 +10,28 @@ export interface AssigneeContext {
|
|
|
10
10
|
seats: Set<string>;
|
|
11
11
|
/** Caller passed `--assign-seat`: filing at a seat is deliberate. */
|
|
12
12
|
allowSeat?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Builds the exact runnable suffix that pairs `--assign-seat` with the
|
|
15
|
+
* refused value, FOR THE VERB THE CALLER IS ACTUALLY ON.
|
|
16
|
+
*
|
|
17
|
+
* This function is shared by four call sites — `add`, `update`,
|
|
18
|
+
* `task upsert`, and the standalone `assign <id> <agent>` — and three of
|
|
19
|
+
* them take the assignee via a `--assign <agent>` FLAG while the fourth
|
|
20
|
+
* takes it POSITIONALLY with no `--assign` flag at all. A single hardcoded
|
|
21
|
+
* `--assign <value> --assign-seat` snippet is therefore correct for three
|
|
22
|
+
* verbs and `error: unknown option '--assign'` on the fourth (todos
|
|
23
|
+
* 75296282, PR hasna/todos#162 review by pr162-reviewer, cycle 1): the
|
|
24
|
+
* seat-refusal message recommended an invocation the verb it was printed
|
|
25
|
+
* from does not accept — the exact class of defect the message exists to
|
|
26
|
+
* remove, relocated rather than fixed.
|
|
27
|
+
*
|
|
28
|
+
* Each call site supplies its own builder naming its own real shape, so the
|
|
29
|
+
* message can never again claim a flag a given verb does not have.
|
|
30
|
+
* Undefined falls back to naming `--assign-seat` in prose with no runnable
|
|
31
|
+
* snippet, which is always safe because it recommends no invocation shape
|
|
32
|
+
* at all.
|
|
33
|
+
*/
|
|
34
|
+
seatHint?: (value: string) => string;
|
|
13
35
|
}
|
|
14
36
|
/**
|
|
15
37
|
* Three outcomes, and the split between REFUSE and WARN is evidence-driven
|