@hasna/conversations 0.2.26 → 0.2.28

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/hook.js CHANGED
@@ -9487,7 +9487,6 @@ function getDb() {
9487
9487
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
9488
9488
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
9489
9489
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_space ON messages(space)");
9490
- db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_messages_uuid ON messages(uuid)");
9491
9490
  db.exec(`
9492
9491
  CREATE TABLE IF NOT EXISTS projects (
9493
9492
  id TEXT PRIMARY KEY,
@@ -10151,6 +10150,15 @@ function resolveIdentity(explicit) {
10151
10150
  }
10152
10151
 
10153
10152
  // src/hooks/blocker-hook.ts
10153
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
10154
+ console.log(`conversations-hook: Claude Code PreToolUse hook for blocking messages.
10155
+
10156
+ Usage: conversations-hook
10157
+
10158
+ Reads CONVERSATIONS_AGENT_ID or CLAUDE_AGENT_ID env var to identify the agent.
10159
+ Outputs blocking messages to stdout and exits 0.`);
10160
+ process.exit(0);
10161
+ }
10154
10162
  var agent = resolveIdentity();
10155
10163
  var db2 = getDb();
10156
10164
  var blockers = db2.prepare(`
package/bin/index.js CHANGED
@@ -13402,7 +13402,6 @@ function getDb() {
13402
13402
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
13403
13403
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
13404
13404
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_space ON messages(space)");
13405
- db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_messages_uuid ON messages(uuid)");
13406
13405
  db.exec(`
13407
13406
  CREATE TABLE IF NOT EXISTS projects (
13408
13407
  id TEXT PRIMARY KEY,
@@ -14123,12 +14122,13 @@ function sendMessage(opts) {
14123
14122
  const normalizedPriority = opts.priority === "low" || opts.priority === "normal" || opts.priority === "high" || opts.priority === "urgent" ? opts.priority : "normal";
14124
14123
  const blocking = opts.blocking ? 1 : 0;
14125
14124
  const replyTo = opts.reply_to || null;
14125
+ const msgUuid = randomUUID().replace(/-/g, "");
14126
14126
  const stmt = db2.prepare(`
14127
- INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
14128
- 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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
14129
14129
  RETURNING *
14130
14130
  `);
14131
- 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);
14132
14132
  const message = parseMessage(row);
14133
14133
  if (opts.attachments && opts.attachments.length > 0) {
14134
14134
  const attachmentsDir = join11(getAttachmentsDir(), String(message.id));
@@ -14928,7 +14928,7 @@ var init_presence = __esm(() => {
14928
14928
  var require_package = __commonJS((exports, module) => {
14929
14929
  module.exports = {
14930
14930
  name: "@hasna/conversations",
14931
- version: "0.2.26",
14931
+ version: "0.2.28",
14932
14932
  description: "Real-time CLI messaging for AI agents",
14933
14933
  type: "module",
14934
14934
  bin: {
package/bin/mcp.js CHANGED
@@ -17682,7 +17682,6 @@ function getDb() {
17682
17682
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
17683
17683
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
17684
17684
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_space ON messages(space)");
17685
- db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_messages_uuid ON messages(uuid)");
17686
17685
  db.exec(`
17687
17686
  CREATE TABLE IF NOT EXISTS projects (
17688
17687
  id TEXT PRIMARY KEY,
@@ -40235,12 +40234,13 @@ function sendMessage(opts) {
40235
40234
  const normalizedPriority = opts.priority === "low" || opts.priority === "normal" || opts.priority === "high" || opts.priority === "urgent" ? opts.priority : "normal";
40236
40235
  const blocking = opts.blocking ? 1 : 0;
40237
40236
  const replyTo = opts.reply_to || null;
40237
+ const msgUuid = randomUUID().replace(/-/g, "");
40238
40238
  const stmt = db2.prepare(`
40239
- INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
40240
- 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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
40241
40241
  RETURNING *
40242
40242
  `);
40243
- 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);
40244
40244
  const message = parseMessage(row);
40245
40245
  if (opts.attachments && opts.attachments.length > 0) {
40246
40246
  const attachmentsDir = join10(getAttachmentsDir(), String(message.id));
@@ -44052,7 +44052,7 @@ function formatError2(e) {
44052
44052
  // package.json
44053
44053
  var package_default = {
44054
44054
  name: "@hasna/conversations",
44055
- version: "0.2.26",
44055
+ version: "0.2.28",
44056
44056
  description: "Real-time CLI messaging for AI agents",
44057
44057
  type: "module",
44058
44058
  bin: {
package/dist/index.js CHANGED
@@ -9511,7 +9511,6 @@ function getDb() {
9511
9511
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
9512
9512
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
9513
9513
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_space ON messages(space)");
9514
- db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_messages_uuid ON messages(uuid)");
9515
9514
  db.exec(`
9516
9515
  CREATE TABLE IF NOT EXISTS projects (
9517
9516
  id TEXT PRIMARY KEY,
@@ -11748,12 +11747,13 @@ function sendMessage(opts) {
11748
11747
  const normalizedPriority = opts.priority === "low" || opts.priority === "normal" || opts.priority === "high" || opts.priority === "urgent" ? opts.priority : "normal";
11749
11748
  const blocking = opts.blocking ? 1 : 0;
11750
11749
  const replyTo = opts.reply_to || null;
11750
+ const msgUuid = randomUUID().replace(/-/g, "");
11751
11751
  const stmt = db2.prepare(`
11752
- INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
11753
- 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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
11754
11754
  RETURNING *
11755
11755
  `);
11756
- 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);
11757
11757
  const message = parseMessage(row);
11758
11758
  if (opts.attachments && opts.attachments.length > 0) {
11759
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.26",
3
+ "version": "0.2.28",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {