@hasna/todos 0.11.83 → 0.11.85

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/storage.js CHANGED
@@ -11914,12 +11914,23 @@ function createPostgresTodosStorageAdapter(options) {
11914
11914
  dependencies: {
11915
11915
  add: (taskId, dependsOn, context) => addDependency2(taskId, dependsOn, store, context),
11916
11916
  remove: (taskId, dependsOn) => removeDependency2(taskId, dependsOn, store),
11917
- list: (taskId) => listDependencies(taskId, store)
11917
+ list: (taskId) => listDependencies(taskId, store),
11918
+ listAll: () => store.list("dependencies")
11918
11919
  },
11919
11920
  verifications: {
11920
11921
  add: (input, context) => addVerification(input, store, context),
11921
11922
  list: (taskId) => listVerifications(taskId, store)
11922
11923
  },
11924
+ commits: {
11925
+ add: (input, context) => addCommit(input, store, context),
11926
+ list: (taskId) => listCommits(taskId, store),
11927
+ find: (sha) => findCommit(sha, store)
11928
+ },
11929
+ gitRefs: {
11930
+ add: (input, context) => addGitRef(input, store, context),
11931
+ list: (taskId) => listGitRefs(taskId, store),
11932
+ find: (ref) => findGitRefs(ref, store)
11933
+ },
11923
11934
  projects: {
11924
11935
  create: (input, context) => createProject2(input, store, context),
11925
11936
  get: (id) => store.get("projects", id),
@@ -11940,7 +11951,9 @@ function createPostgresTodosStorageAdapter(options) {
11940
11951
  get: (id) => store.get("agents", id),
11941
11952
  getByName: async (name) => (await store.list("agents")).find((agent) => agent.name === name) ?? null,
11942
11953
  list: async (options2) => (await store.list("agents")).filter((agent) => options2?.include_archived || agent.status !== "archived").sort((a, b) => a.name.localeCompare(b.name)),
11943
- update: (id, input) => updateAgent2(id, input, store)
11954
+ update: (id, input) => updateAgent2(id, input, store),
11955
+ heartbeat: (idOrName, context) => heartbeatAgent(idOrName, store, context),
11956
+ release: (idOrName, sessionId, context) => releaseAgent2(idOrName, sessionId, store, context)
11944
11957
  },
11945
11958
  taskLists: {
11946
11959
  create: (input, context) => createTaskList2(input, store, context),
@@ -12471,6 +12484,53 @@ async function addVerification(input, store, context) {
12471
12484
  async function listVerifications(taskId, store) {
12472
12485
  return (await store.list("verifications")).filter((verification) => verification.task_id === taskId).sort((a, b) => b.run_at.localeCompare(a.run_at));
12473
12486
  }
12487
+ async function addCommit(input, store, context) {
12488
+ if (!await store.get("tasks", input.task_id))
12489
+ throw new Error(`Task not found: ${input.task_id}`);
12490
+ const timestamp = new Date().toISOString();
12491
+ const commit = {
12492
+ id: randomUUID3(),
12493
+ task_id: input.task_id,
12494
+ sha: input.sha,
12495
+ message: input.message ?? null,
12496
+ author: input.author ?? null,
12497
+ files_changed: input.files_changed ?? null,
12498
+ created_at: timestamp
12499
+ };
12500
+ await store.upsert("commits", { ...commit, updated_at: timestamp }, context);
12501
+ return commit;
12502
+ }
12503
+ async function listCommits(taskId, store) {
12504
+ return (await store.list("commits")).filter((commit) => commit.task_id === taskId).sort((a, b) => b.created_at.localeCompare(a.created_at));
12505
+ }
12506
+ async function findCommit(sha, store) {
12507
+ const matches = (await store.list("commits")).filter((commit) => commit.sha === sha || commit.sha.startsWith(sha) || sha.startsWith(commit.sha)).sort((a, b) => b.created_at.localeCompare(a.created_at));
12508
+ return matches[0] ?? null;
12509
+ }
12510
+ async function addGitRef(input, store, context) {
12511
+ if (!await store.get("tasks", input.task_id))
12512
+ throw new Error(`Task not found: ${input.task_id}`);
12513
+ const timestamp = new Date().toISOString();
12514
+ const gitRef = {
12515
+ id: randomUUID3(),
12516
+ task_id: input.task_id,
12517
+ ref_type: input.ref_type,
12518
+ name: input.name,
12519
+ url: input.url ?? null,
12520
+ provider: input.provider ?? null,
12521
+ metadata: input.metadata ?? {},
12522
+ created_at: timestamp,
12523
+ updated_at: timestamp
12524
+ };
12525
+ await store.upsert("refs", gitRef, context);
12526
+ return gitRef;
12527
+ }
12528
+ async function listGitRefs(taskId, store) {
12529
+ return (await store.list("refs")).filter((ref) => ref.task_id === taskId).sort((a, b) => b.created_at.localeCompare(a.created_at));
12530
+ }
12531
+ async function findGitRefs(ref, store) {
12532
+ return (await store.list("refs")).filter((r) => r.name === ref).sort((a, b) => b.created_at.localeCompare(a.created_at));
12533
+ }
12474
12534
  var TASK_ORDER_BY = "ORDER BY CASE payload->>'priority' WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END ASC, payload->>'created_at' ASC, payload->>'id' ASC";
12475
12535
  function toFilterArray(value) {
12476
12536
  return Array.isArray(value) ? value : [value];
@@ -12618,6 +12678,28 @@ async function updateAgent2(id, input, store) {
12618
12678
  last_seen_at: new Date().toISOString()
12619
12679
  });
12620
12680
  }
12681
+ async function resolveAgent(idOrName, store) {
12682
+ const byId = await store.get("agents", idOrName);
12683
+ if (byId)
12684
+ return byId;
12685
+ return (await store.list("agents")).find((agent) => agent.name === idOrName) ?? null;
12686
+ }
12687
+ async function heartbeatAgent(idOrName, store, context) {
12688
+ const agent = await resolveAgent(idOrName, store);
12689
+ if (!agent)
12690
+ return null;
12691
+ return store.upsert("agents", { ...agent, last_seen_at: new Date().toISOString() }, context);
12692
+ }
12693
+ async function releaseAgent2(idOrName, sessionId, store, context) {
12694
+ const agent = await resolveAgent(idOrName, store);
12695
+ if (!agent)
12696
+ return null;
12697
+ if (sessionId && agent.session_id && agent.session_id !== sessionId) {
12698
+ return { agent, released: false };
12699
+ }
12700
+ const updated = await store.upsert("agents", { ...agent, session_id: null, last_seen_at: new Date().toISOString() }, context);
12701
+ return { agent: updated, released: true };
12702
+ }
12621
12703
  async function createTaskList2(input, store, context) {
12622
12704
  const timestamp = new Date().toISOString();
12623
12705
  return store.upsert("task_lists", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/todos",
3
- "version": "0.11.83",
3
+ "version": "0.11.85",
4
4
  "description": "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",