@hasna/conversations 0.1.22 → 0.1.23

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/bin/index.js CHANGED
@@ -3314,6 +3314,7 @@ function heartbeat(agent, status, metadata) {
3314
3314
  const db2 = getDb();
3315
3315
  const metadataJson = metadata ? JSON.stringify(metadata) : null;
3316
3316
  const resolvedStatus = status || "online";
3317
+ const normalizedAgent = agent.trim().toLowerCase();
3317
3318
  db2.prepare(`
3318
3319
  INSERT INTO agent_presence (agent, status, last_seen_at, metadata)
3319
3320
  VALUES (?, ?, strftime('%Y-%m-%dT%H:%M:%f', 'now'), ?)
@@ -3321,11 +3322,12 @@ function heartbeat(agent, status, metadata) {
3321
3322
  status = excluded.status,
3322
3323
  last_seen_at = excluded.last_seen_at,
3323
3324
  metadata = excluded.metadata
3324
- `).run(agent, resolvedStatus, metadataJson);
3325
+ `).run(normalizedAgent, resolvedStatus, metadataJson);
3325
3326
  }
3326
3327
  function getPresence(agent) {
3327
3328
  const db2 = getDb();
3328
- const row = db2.prepare("SELECT * FROM agent_presence WHERE agent = ?").get(agent);
3329
+ const normalizedAgent = agent.trim().toLowerCase();
3330
+ const row = db2.prepare("SELECT * FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedAgent);
3329
3331
  return row ? parsePresence(row) : null;
3330
3332
  }
3331
3333
  function listAgents(opts) {
@@ -3341,18 +3343,21 @@ function listAgents(opts) {
3341
3343
  }
3342
3344
  function removePresence(agent) {
3343
3345
  const db2 = getDb();
3344
- const result = db2.prepare("DELETE FROM agent_presence WHERE agent = ?").run(agent);
3346
+ const normalizedAgent = agent.trim().toLowerCase();
3347
+ const result = db2.prepare("DELETE FROM agent_presence WHERE LOWER(agent) = ?").run(normalizedAgent);
3345
3348
  return result.changes > 0;
3346
3349
  }
3347
3350
  function renameAgent(oldName, newName) {
3348
3351
  const db2 = getDb();
3349
- const existing = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(oldName);
3352
+ const normalizedOld = oldName.trim().toLowerCase();
3353
+ const normalizedNew = newName.trim().toLowerCase();
3354
+ const existing = db2.prepare("SELECT agent FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedOld);
3350
3355
  if (!existing)
3351
3356
  return false;
3352
- const conflict = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(newName);
3357
+ const conflict = db2.prepare("SELECT agent FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedNew);
3353
3358
  if (conflict)
3354
- throw new Error(`Agent "${newName}" already exists`);
3355
- db2.prepare("UPDATE agent_presence SET agent = ? WHERE agent = ?").run(newName, oldName);
3359
+ throw new Error(`Agent "${normalizedNew}" already exists`);
3360
+ db2.prepare("UPDATE agent_presence SET agent = ? WHERE LOWER(agent) = ?").run(normalizedNew, normalizedOld);
3356
3361
  return true;
3357
3362
  }
3358
3363
  var ONLINE_THRESHOLD_SECONDS = 60;
@@ -3504,7 +3509,7 @@ var init_poll = __esm(() => {
3504
3509
  var require_package = __commonJS((exports, module) => {
3505
3510
  module.exports = {
3506
3511
  name: "@hasna/conversations",
3507
- version: "0.1.22",
3512
+ version: "0.1.23",
3508
3513
  description: "Real-time CLI messaging for AI agents",
3509
3514
  type: "module",
3510
3515
  bin: {
@@ -30872,7 +30877,7 @@ var require_formats = __commonJS((exports) => {
30872
30877
  }
30873
30878
  var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
30874
30879
  function getTime(strictTimeZone) {
30875
- return function time(str) {
30880
+ return function time3(str) {
30876
30881
  const matches = TIME.exec(str);
30877
30882
  if (!matches)
30878
30883
  return false;
package/bin/mcp.js CHANGED
@@ -6302,7 +6302,7 @@ var require_formats = __commonJS((exports) => {
6302
6302
  }
6303
6303
  var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
6304
6304
  function getTime(strictTimeZone) {
6305
- return function time(str) {
6305
+ return function time3(str) {
6306
6306
  const matches = TIME.exec(str);
6307
6307
  if (!matches)
6308
6308
  return false;
@@ -29739,6 +29739,7 @@ function heartbeat(agent, status, metadata) {
29739
29739
  const db2 = getDb();
29740
29740
  const metadataJson = metadata ? JSON.stringify(metadata) : null;
29741
29741
  const resolvedStatus = status || "online";
29742
+ const normalizedAgent = agent.trim().toLowerCase();
29742
29743
  db2.prepare(`
29743
29744
  INSERT INTO agent_presence (agent, status, last_seen_at, metadata)
29744
29745
  VALUES (?, ?, strftime('%Y-%m-%dT%H:%M:%f', 'now'), ?)
@@ -29746,7 +29747,7 @@ function heartbeat(agent, status, metadata) {
29746
29747
  status = excluded.status,
29747
29748
  last_seen_at = excluded.last_seen_at,
29748
29749
  metadata = excluded.metadata
29749
- `).run(agent, resolvedStatus, metadataJson);
29750
+ `).run(normalizedAgent, resolvedStatus, metadataJson);
29750
29751
  }
29751
29752
  function listAgents(opts) {
29752
29753
  const db2 = getDb();
@@ -29761,24 +29762,27 @@ function listAgents(opts) {
29761
29762
  }
29762
29763
  function removePresence(agent) {
29763
29764
  const db2 = getDb();
29764
- const result = db2.prepare("DELETE FROM agent_presence WHERE agent = ?").run(agent);
29765
+ const normalizedAgent = agent.trim().toLowerCase();
29766
+ const result = db2.prepare("DELETE FROM agent_presence WHERE LOWER(agent) = ?").run(normalizedAgent);
29765
29767
  return result.changes > 0;
29766
29768
  }
29767
29769
  function renameAgent(oldName, newName) {
29768
29770
  const db2 = getDb();
29769
- const existing = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(oldName);
29771
+ const normalizedOld = oldName.trim().toLowerCase();
29772
+ const normalizedNew = newName.trim().toLowerCase();
29773
+ const existing = db2.prepare("SELECT agent FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedOld);
29770
29774
  if (!existing)
29771
29775
  return false;
29772
- const conflict = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(newName);
29776
+ const conflict = db2.prepare("SELECT agent FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedNew);
29773
29777
  if (conflict)
29774
- throw new Error(`Agent "${newName}" already exists`);
29775
- db2.prepare("UPDATE agent_presence SET agent = ? WHERE agent = ?").run(newName, oldName);
29778
+ throw new Error(`Agent "${normalizedNew}" already exists`);
29779
+ db2.prepare("UPDATE agent_presence SET agent = ? WHERE LOWER(agent) = ?").run(normalizedNew, normalizedOld);
29776
29780
  return true;
29777
29781
  }
29778
29782
  // package.json
29779
29783
  var package_default = {
29780
29784
  name: "@hasna/conversations",
29781
- version: "0.1.22",
29785
+ version: "0.1.23",
29782
29786
  description: "Real-time CLI messaging for AI agents",
29783
29787
  type: "module",
29784
29788
  bin: {
package/dist/index.js CHANGED
@@ -3426,6 +3426,7 @@ function heartbeat(agent, status, metadata) {
3426
3426
  const db2 = getDb();
3427
3427
  const metadataJson = metadata ? JSON.stringify(metadata) : null;
3428
3428
  const resolvedStatus = status || "online";
3429
+ const normalizedAgent = agent.trim().toLowerCase();
3429
3430
  db2.prepare(`
3430
3431
  INSERT INTO agent_presence (agent, status, last_seen_at, metadata)
3431
3432
  VALUES (?, ?, strftime('%Y-%m-%dT%H:%M:%f', 'now'), ?)
@@ -3433,11 +3434,12 @@ function heartbeat(agent, status, metadata) {
3433
3434
  status = excluded.status,
3434
3435
  last_seen_at = excluded.last_seen_at,
3435
3436
  metadata = excluded.metadata
3436
- `).run(agent, resolvedStatus, metadataJson);
3437
+ `).run(normalizedAgent, resolvedStatus, metadataJson);
3437
3438
  }
3438
3439
  function getPresence(agent) {
3439
3440
  const db2 = getDb();
3440
- const row = db2.prepare("SELECT * FROM agent_presence WHERE agent = ?").get(agent);
3441
+ const normalizedAgent = agent.trim().toLowerCase();
3442
+ const row = db2.prepare("SELECT * FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedAgent);
3441
3443
  return row ? parsePresence(row) : null;
3442
3444
  }
3443
3445
  function listAgents(opts) {
@@ -3453,18 +3455,21 @@ function listAgents(opts) {
3453
3455
  }
3454
3456
  function removePresence(agent) {
3455
3457
  const db2 = getDb();
3456
- const result = db2.prepare("DELETE FROM agent_presence WHERE agent = ?").run(agent);
3458
+ const normalizedAgent = agent.trim().toLowerCase();
3459
+ const result = db2.prepare("DELETE FROM agent_presence WHERE LOWER(agent) = ?").run(normalizedAgent);
3457
3460
  return result.changes > 0;
3458
3461
  }
3459
3462
  function renameAgent(oldName, newName) {
3460
3463
  const db2 = getDb();
3461
- const existing = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(oldName);
3464
+ const normalizedOld = oldName.trim().toLowerCase();
3465
+ const normalizedNew = newName.trim().toLowerCase();
3466
+ const existing = db2.prepare("SELECT agent FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedOld);
3462
3467
  if (!existing)
3463
3468
  return false;
3464
- const conflict = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(newName);
3469
+ const conflict = db2.prepare("SELECT agent FROM agent_presence WHERE LOWER(agent) = ?").get(normalizedNew);
3465
3470
  if (conflict)
3466
- throw new Error(`Agent "${newName}" already exists`);
3467
- db2.prepare("UPDATE agent_presence SET agent = ? WHERE agent = ?").run(newName, oldName);
3471
+ throw new Error(`Agent "${normalizedNew}" already exists`);
3472
+ db2.prepare("UPDATE agent_presence SET agent = ? WHERE LOWER(agent) = ?").run(normalizedNew, normalizedOld);
3468
3473
  return true;
3469
3474
  }
3470
3475
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {