@hasna/conversations 0.2.27 → 0.2.29

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
@@ -14122,12 +14122,13 @@ function sendMessage(opts) {
14122
14122
  const normalizedPriority = opts.priority === "low" || opts.priority === "normal" || opts.priority === "high" || opts.priority === "urgent" ? opts.priority : "normal";
14123
14123
  const blocking = opts.blocking ? 1 : 0;
14124
14124
  const replyTo = opts.reply_to || null;
14125
+ const msgUuid = randomUUID().replace(/-/g, "");
14125
14126
  const stmt = db2.prepare(`
14126
- INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
14127
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
14127
+ INSERT INTO messages (uuid, session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
14128
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
14128
14129
  RETURNING *
14129
14130
  `);
14130
- const row = stmt.get(sessionId, opts.from, opts.to, opts.space || null, opts.project_id || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
14131
+ const row = stmt.get(msgUuid, sessionId, opts.from, opts.to, opts.space || null, opts.project_id || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
14131
14132
  const message = parseMessage(row);
14132
14133
  if (opts.attachments && opts.attachments.length > 0) {
14133
14134
  const attachmentsDir = join11(getAttachmentsDir(), String(message.id));
@@ -14927,7 +14928,7 @@ var init_presence = __esm(() => {
14927
14928
  var require_package = __commonJS((exports, module) => {
14928
14929
  module.exports = {
14929
14930
  name: "@hasna/conversations",
14930
- version: "0.2.27",
14931
+ version: "0.2.29",
14931
14932
  description: "Real-time CLI messaging for AI agents",
14932
14933
  type: "module",
14933
14934
  bin: {
@@ -48517,17 +48518,18 @@ init_presence();
48517
48518
  init_db();
48518
48519
  import chalk4 from "chalk";
48519
48520
  function registerMessagingCommands(program2) {
48520
- program2.command("send").description("Send a message to an agent").argument("<message>", "Message content").requiredOption("--to <agent>", "Recipient agent ID").option("--from <agent>", "Sender agent ID").option("--session <id>", "Session ID (auto-generated if omitted)").option("--priority <level>", "Priority: low, normal, high, urgent", "normal").option("--working-dir <path>", "Working directory context").option("--repository <repo>", "Repository context").option("--branch <branch>", "Branch context").option("--metadata <json>", "JSON metadata string").option("--blocking", "Send as a blocking message (recipient must acknowledge)").option("--json", "Output as JSON").action((message, opts) => {
48521
+ program2.command("send").description("Send a message to an agent").argument("<message>", "Message content").option("--to <agent>", "Recipient agent ID (required unless --space is used)").option("--from <agent>", "Sender agent ID").option("--session <id>", "Session ID (auto-generated if omitted)").option("--priority <level>", "Priority: low, normal, high, urgent", "normal").option("--working-dir <path>", "Working directory context").option("--repository <repo>", "Repository context").option("--branch <branch>", "Branch context").option("--metadata <json>", "JSON metadata string").option("--space <name>", "Send to a space instead of a specific agent").option("--blocking", "Send as a blocking message (recipient must acknowledge)").option("--json", "Output as JSON").action((message, opts) => {
48521
48522
  const from = resolveIdentity(opts.from).trim();
48522
48523
  const to = typeof opts.to === "string" ? opts.to.trim() : "";
48524
+ const space = typeof opts.space === "string" ? opts.space.trim() : "";
48523
48525
  const content = typeof message === "string" ? message : "";
48524
48526
  const session = typeof opts.session === "string" && opts.session.trim() ? opts.session.trim() : undefined;
48525
48527
  if (!from) {
48526
48528
  console.error(chalk4.red("Sender identity is required."));
48527
48529
  process.exit(1);
48528
48530
  }
48529
- if (!to) {
48530
- console.error(chalk4.red("Recipient is required."));
48531
+ if (!to && !space) {
48532
+ console.error(chalk4.red("Recipient is required: use --to <agent> or --space <name>."));
48531
48533
  process.exit(1);
48532
48534
  }
48533
48535
  if (!content.trim()) {
@@ -48545,7 +48547,8 @@ function registerMessagingCommands(program2) {
48545
48547
  }
48546
48548
  const msg = sendMessage({
48547
48549
  from,
48548
- to,
48550
+ to: to || from,
48551
+ space: space || undefined,
48549
48552
  content,
48550
48553
  session_id: session,
48551
48554
  priority: opts.priority,
@@ -48557,6 +48560,8 @@ function registerMessagingCommands(program2) {
48557
48560
  });
48558
48561
  if (opts.json) {
48559
48562
  console.log(JSON.stringify(msg, null, 2));
48563
+ } else if (space) {
48564
+ console.log(chalk4.green(`Message sent to #${space}`) + chalk4.dim(` (id: ${msg.id})`));
48560
48565
  } else {
48561
48566
  console.log(chalk4.green(`Message sent`) + chalk4.dim(` (id: ${msg.id}, session: ${msg.session_id})`));
48562
48567
  }
@@ -49411,7 +49416,7 @@ function registerProjectCommands(program2) {
49411
49416
  }
49412
49417
  closeDb();
49413
49418
  });
49414
- project.command("update").description("Update a project").argument("<id>", "Project ID").option("--name <name>", "New name").option("--description <text>", "New description").option("--path <path>", "New path").option("--status <status>", "New status (active/archived)").option("--repository <url>", "New repository URL").option("--tags <json>", "New tags (JSON array)").option("--json", "Output as JSON").action((id, opts) => {
49419
+ project.command("update").description("Update a project").argument("<id-or-name>", "Project ID or name").option("--name <name>", "New name").option("--description <text>", "New description").option("--path <path>", "New path").option("--status <status>", "New status (active/archived)").option("--repository <url>", "New repository URL").option("--tags <json>", "New tags (JSON array)").option("--json", "Output as JSON").action((id, opts) => {
49415
49420
  const updates = {};
49416
49421
  if (opts.name)
49417
49422
  updates.name = opts.name;
@@ -49432,7 +49437,9 @@ function registerProjectCommands(program2) {
49432
49437
  }
49433
49438
  }
49434
49439
  try {
49435
- const p = updateProject(id, updates);
49440
+ const isUuid = /^[0-9a-f-]{36}$/i.test(id);
49441
+ const resolvedId = isUuid ? id : getProjectByName(id)?.id ?? id;
49442
+ const p = updateProject(resolvedId, updates);
49436
49443
  if (opts.json) {
49437
49444
  console.log(JSON.stringify(p, null, 2));
49438
49445
  } else {
@@ -49444,9 +49451,11 @@ function registerProjectCommands(program2) {
49444
49451
  }
49445
49452
  closeDb();
49446
49453
  });
49447
- project.command("delete").description("Delete a project").argument("<id>", "Project ID").option("--json", "Output as JSON").action((id, opts) => {
49454
+ project.command("delete").description("Delete a project").argument("<id-or-name>", "Project ID or name").option("--json", "Output as JSON").action((id, opts) => {
49448
49455
  try {
49449
- const deleted = deleteProject(id);
49456
+ const isUuid = /^[0-9a-f-]{36}$/i.test(id);
49457
+ const resolvedId = isUuid ? id : getProjectByName(id)?.id ?? id;
49458
+ const deleted = deleteProject(resolvedId);
49450
49459
  if (!deleted) {
49451
49460
  console.error(chalk6.red(`Project "${id}" not found.`));
49452
49461
  process.exit(1);
package/bin/mcp.js CHANGED
@@ -40234,12 +40234,13 @@ function sendMessage(opts) {
40234
40234
  const normalizedPriority = opts.priority === "low" || opts.priority === "normal" || opts.priority === "high" || opts.priority === "urgent" ? opts.priority : "normal";
40235
40235
  const blocking = opts.blocking ? 1 : 0;
40236
40236
  const replyTo = opts.reply_to || null;
40237
+ const msgUuid = randomUUID().replace(/-/g, "");
40237
40238
  const stmt = db2.prepare(`
40238
- INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
40239
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
40239
+ INSERT INTO messages (uuid, session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
40240
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
40240
40241
  RETURNING *
40241
40242
  `);
40242
- const row = stmt.get(sessionId, opts.from, opts.to, opts.space || null, opts.project_id || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
40243
+ const row = stmt.get(msgUuid, sessionId, opts.from, opts.to, opts.space || null, opts.project_id || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
40243
40244
  const message = parseMessage(row);
40244
40245
  if (opts.attachments && opts.attachments.length > 0) {
40245
40246
  const attachmentsDir = join10(getAttachmentsDir(), String(message.id));
@@ -44051,7 +44052,7 @@ function formatError2(e) {
44051
44052
  // package.json
44052
44053
  var package_default = {
44053
44054
  name: "@hasna/conversations",
44054
- version: "0.2.27",
44055
+ version: "0.2.29",
44055
44056
  description: "Real-time CLI messaging for AI agents",
44056
44057
  type: "module",
44057
44058
  bin: {
package/dist/index.js CHANGED
@@ -11747,12 +11747,13 @@ function sendMessage(opts) {
11747
11747
  const normalizedPriority = opts.priority === "low" || opts.priority === "normal" || opts.priority === "high" || opts.priority === "urgent" ? opts.priority : "normal";
11748
11748
  const blocking = opts.blocking ? 1 : 0;
11749
11749
  const replyTo = opts.reply_to || null;
11750
+ const msgUuid = randomUUID().replace(/-/g, "");
11750
11751
  const stmt = db2.prepare(`
11751
- INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
11752
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
11752
+ INSERT INTO messages (uuid, session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
11753
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
11753
11754
  RETURNING *
11754
11755
  `);
11755
- const row = stmt.get(sessionId, opts.from, opts.to, opts.space || null, opts.project_id || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
11756
+ const row = stmt.get(msgUuid, sessionId, opts.from, opts.to, opts.space || null, opts.project_id || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
11756
11757
  const message = parseMessage(row);
11757
11758
  if (opts.attachments && opts.attachments.length > 0) {
11758
11759
  const attachmentsDir = join8(getAttachmentsDir(), String(message.id));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {