@hasna/conversations 0.1.30 → 0.1.31

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
@@ -60,6 +60,7 @@ function getDb() {
60
60
  from_agent TEXT NOT NULL,
61
61
  to_agent TEXT NOT NULL,
62
62
  space TEXT,
63
+ project_id TEXT,
63
64
  content TEXT NOT NULL,
64
65
  priority TEXT NOT NULL DEFAULT 'normal',
65
66
  working_dir TEXT,
@@ -214,6 +215,10 @@ function getDb() {
214
215
  db.exec("ALTER TABLE messages ADD COLUMN reply_to INTEGER REFERENCES messages(id)");
215
216
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_reply_to ON messages(reply_to)");
216
217
  }
218
+ if (!colNames2.includes("project_id")) {
219
+ db.exec("ALTER TABLE messages ADD COLUMN project_id TEXT");
220
+ db.exec("CREATE INDEX IF NOT EXISTS idx_messages_project ON messages(project_id)");
221
+ }
217
222
  const presenceCols = db.prepare("PRAGMA table_info(agent_presence)").all();
218
223
  const presenceColNames = presenceCols.map((c) => c.name);
219
224
  if (!presenceColNames.includes("id")) {
package/bin/index.js CHANGED
@@ -1914,6 +1914,7 @@ function getDb() {
1914
1914
  from_agent TEXT NOT NULL,
1915
1915
  to_agent TEXT NOT NULL,
1916
1916
  space TEXT,
1917
+ project_id TEXT,
1917
1918
  content TEXT NOT NULL,
1918
1919
  priority TEXT NOT NULL DEFAULT 'normal',
1919
1920
  working_dir TEXT,
@@ -2068,6 +2069,10 @@ function getDb() {
2068
2069
  db.exec("ALTER TABLE messages ADD COLUMN reply_to INTEGER REFERENCES messages(id)");
2069
2070
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_reply_to ON messages(reply_to)");
2070
2071
  }
2072
+ if (!colNames2.includes("project_id")) {
2073
+ db.exec("ALTER TABLE messages ADD COLUMN project_id TEXT");
2074
+ db.exec("CREATE INDEX IF NOT EXISTS idx_messages_project ON messages(project_id)");
2075
+ }
2071
2076
  const presenceCols = db.prepare("PRAGMA table_info(agent_presence)").all();
2072
2077
  const presenceColNames = presenceCols.map((c) => c.name);
2073
2078
  if (!presenceColNames.includes("id")) {
@@ -2279,11 +2284,11 @@ function sendMessage(opts) {
2279
2284
  const blocking = opts.blocking ? 1 : 0;
2280
2285
  const replyTo = opts.reply_to || null;
2281
2286
  const stmt = db2.prepare(`
2282
- INSERT INTO messages (session_id, from_agent, to_agent, space, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
2283
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2287
+ INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
2288
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2284
2289
  RETURNING *
2285
2290
  `);
2286
- const row = stmt.get(sessionId, opts.from, opts.to, opts.space || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
2291
+ 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);
2287
2292
  const message = parseMessage(row);
2288
2293
  if (opts.attachments && opts.attachments.length > 0) {
2289
2294
  const attachmentsDir = join3(getAttachmentsDir(), String(message.id));
@@ -2327,6 +2332,10 @@ function readMessages(opts = {}) {
2327
2332
  conditions.push("space = ?");
2328
2333
  params.push(opts.space);
2329
2334
  }
2335
+ if (opts.project_id) {
2336
+ conditions.push("project_id = ?");
2337
+ params.push(opts.project_id);
2338
+ }
2330
2339
  if (opts.since) {
2331
2340
  conditions.push("created_at > ?");
2332
2341
  params.push(opts.since);
@@ -3613,7 +3622,7 @@ var init_poll = __esm(() => {
3613
3622
  var require_package = __commonJS((exports, module) => {
3614
3623
  module.exports = {
3615
3624
  name: "@hasna/conversations",
3616
- version: "0.1.30",
3625
+ version: "0.1.31",
3617
3626
  description: "Real-time CLI messaging for AI agents",
3618
3627
  type: "module",
3619
3628
  bin: {
@@ -32590,17 +32599,19 @@ var init_mcp2 = __esm(() => {
32590
32599
  content: exports_external.string(),
32591
32600
  from: exports_external.string().optional(),
32592
32601
  priority: exports_external.string().optional(),
32593
- blocking: exports_external.coerce.boolean().optional()
32602
+ blocking: exports_external.coerce.boolean().optional(),
32603
+ project_id: exports_external.string().optional()
32594
32604
  }
32595
32605
  }, async (args) => {
32596
- const { from: fromParam, to, content, priority, blocking } = args;
32606
+ const { from: fromParam, to, content, priority, blocking, project_id } = args;
32597
32607
  const from = resolveIdentity(fromParam);
32598
32608
  const msg = sendMessage({
32599
32609
  from,
32600
32610
  to,
32601
32611
  content,
32602
32612
  priority,
32603
- blocking
32613
+ blocking,
32614
+ project_id
32604
32615
  });
32605
32616
  return {
32606
32617
  content: [{ type: "text", text: JSON.stringify(msg) }]
@@ -32613,6 +32624,7 @@ var init_mcp2 = __esm(() => {
32613
32624
  from: exports_external.string().optional(),
32614
32625
  to: exports_external.string().optional(),
32615
32626
  space: exports_external.string().optional(),
32627
+ project_id: exports_external.string().optional(),
32616
32628
  since: exports_external.string().optional(),
32617
32629
  limit: exports_external.coerce.number().optional(),
32618
32630
  unread_only: exports_external.coerce.boolean().optional()
package/bin/mcp.js CHANGED
@@ -6546,6 +6546,7 @@ function getDb() {
6546
6546
  from_agent TEXT NOT NULL,
6547
6547
  to_agent TEXT NOT NULL,
6548
6548
  space TEXT,
6549
+ project_id TEXT,
6549
6550
  content TEXT NOT NULL,
6550
6551
  priority TEXT NOT NULL DEFAULT 'normal',
6551
6552
  working_dir TEXT,
@@ -6700,6 +6701,10 @@ function getDb() {
6700
6701
  db.exec("ALTER TABLE messages ADD COLUMN reply_to INTEGER REFERENCES messages(id)");
6701
6702
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_reply_to ON messages(reply_to)");
6702
6703
  }
6704
+ if (!colNames2.includes("project_id")) {
6705
+ db.exec("ALTER TABLE messages ADD COLUMN project_id TEXT");
6706
+ db.exec("CREATE INDEX IF NOT EXISTS idx_messages_project ON messages(project_id)");
6707
+ }
6703
6708
  const presenceCols = db.prepare("PRAGMA table_info(agent_presence)").all();
6704
6709
  const presenceColNames = presenceCols.map((c) => c.name);
6705
6710
  if (!presenceColNames.includes("id")) {
@@ -28732,11 +28737,11 @@ function sendMessage(opts) {
28732
28737
  const blocking = opts.blocking ? 1 : 0;
28733
28738
  const replyTo = opts.reply_to || null;
28734
28739
  const stmt = db2.prepare(`
28735
- INSERT INTO messages (session_id, from_agent, to_agent, space, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
28736
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
28740
+ INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
28741
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
28737
28742
  RETURNING *
28738
28743
  `);
28739
- const row = stmt.get(sessionId, opts.from, opts.to, opts.space || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
28744
+ 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);
28740
28745
  const message = parseMessage(row);
28741
28746
  if (opts.attachments && opts.attachments.length > 0) {
28742
28747
  const attachmentsDir = join3(getAttachmentsDir(), String(message.id));
@@ -28780,6 +28785,10 @@ function readMessages(opts = {}) {
28780
28785
  conditions.push("space = ?");
28781
28786
  params.push(opts.space);
28782
28787
  }
28788
+ if (opts.project_id) {
28789
+ conditions.push("project_id = ?");
28790
+ params.push(opts.project_id);
28791
+ }
28783
28792
  if (opts.since) {
28784
28793
  conditions.push("created_at > ?");
28785
28794
  params.push(opts.since);
@@ -29886,7 +29895,7 @@ function renameAgent(oldName, newName) {
29886
29895
  // package.json
29887
29896
  var package_default = {
29888
29897
  name: "@hasna/conversations",
29889
- version: "0.1.30",
29898
+ version: "0.1.31",
29890
29899
  description: "Real-time CLI messaging for AI agents",
29891
29900
  type: "module",
29892
29901
  bin: {
@@ -29975,17 +29984,19 @@ server.registerTool("send_message", {
29975
29984
  content: exports_external.string(),
29976
29985
  from: exports_external.string().optional(),
29977
29986
  priority: exports_external.string().optional(),
29978
- blocking: exports_external.coerce.boolean().optional()
29987
+ blocking: exports_external.coerce.boolean().optional(),
29988
+ project_id: exports_external.string().optional()
29979
29989
  }
29980
29990
  }, async (args) => {
29981
- const { from: fromParam, to, content, priority, blocking } = args;
29991
+ const { from: fromParam, to, content, priority, blocking, project_id } = args;
29982
29992
  const from = resolveIdentity(fromParam);
29983
29993
  const msg = sendMessage({
29984
29994
  from,
29985
29995
  to,
29986
29996
  content,
29987
29997
  priority,
29988
- blocking
29998
+ blocking,
29999
+ project_id
29989
30000
  });
29990
30001
  return {
29991
30002
  content: [{ type: "text", text: JSON.stringify(msg) }]
@@ -29998,6 +30009,7 @@ server.registerTool("read_messages", {
29998
30009
  from: exports_external.string().optional(),
29999
30010
  to: exports_external.string().optional(),
30000
30011
  space: exports_external.string().optional(),
30012
+ project_id: exports_external.string().optional(),
30001
30013
  since: exports_external.string().optional(),
30002
30014
  limit: exports_external.coerce.number().optional(),
30003
30015
  unread_only: exports_external.coerce.boolean().optional()
package/dist/index.js CHANGED
@@ -73,6 +73,7 @@ function getDb() {
73
73
  from_agent TEXT NOT NULL,
74
74
  to_agent TEXT NOT NULL,
75
75
  space TEXT,
76
+ project_id TEXT,
76
77
  content TEXT NOT NULL,
77
78
  priority TEXT NOT NULL DEFAULT 'normal',
78
79
  working_dir TEXT,
@@ -227,6 +228,10 @@ function getDb() {
227
228
  db.exec("ALTER TABLE messages ADD COLUMN reply_to INTEGER REFERENCES messages(id)");
228
229
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_reply_to ON messages(reply_to)");
229
230
  }
231
+ if (!colNames2.includes("project_id")) {
232
+ db.exec("ALTER TABLE messages ADD COLUMN project_id TEXT");
233
+ db.exec("CREATE INDEX IF NOT EXISTS idx_messages_project ON messages(project_id)");
234
+ }
230
235
  const presenceCols = db.prepare("PRAGMA table_info(agent_presence)").all();
231
236
  const presenceColNames = presenceCols.map((c) => c.name);
232
237
  if (!presenceColNames.includes("id")) {
@@ -2253,11 +2258,11 @@ function sendMessage(opts) {
2253
2258
  const blocking = opts.blocking ? 1 : 0;
2254
2259
  const replyTo = opts.reply_to || null;
2255
2260
  const stmt = db2.prepare(`
2256
- INSERT INTO messages (session_id, from_agent, to_agent, space, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
2257
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2261
+ INSERT INTO messages (session_id, from_agent, to_agent, space, project_id, content, priority, working_dir, repository, branch, metadata, blocking, reply_to)
2262
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2258
2263
  RETURNING *
2259
2264
  `);
2260
- const row = stmt.get(sessionId, opts.from, opts.to, opts.space || null, opts.content, normalizedPriority, opts.working_dir || null, opts.repository || null, opts.branch || null, metadata, blocking, replyTo);
2265
+ 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);
2261
2266
  const message = parseMessage(row);
2262
2267
  if (opts.attachments && opts.attachments.length > 0) {
2263
2268
  const attachmentsDir = join3(getAttachmentsDir(), String(message.id));
@@ -2301,6 +2306,10 @@ function readMessages(opts = {}) {
2301
2306
  conditions.push("space = ?");
2302
2307
  params.push(opts.space);
2303
2308
  }
2309
+ if (opts.project_id) {
2310
+ conditions.push("project_id = ?");
2311
+ params.push(opts.project_id);
2312
+ }
2304
2313
  if (opts.since) {
2305
2314
  conditions.push("created_at > ?");
2306
2315
  params.push(opts.since);
package/dist/types.d.ts CHANGED
@@ -5,6 +5,7 @@ export interface Message {
5
5
  from_agent: string;
6
6
  to_agent: string;
7
7
  space: string | null;
8
+ project_id: string | null;
8
9
  content: string;
9
10
  priority: Priority;
10
11
  working_dir: string | null;
@@ -80,6 +81,7 @@ export interface SendMessageOptions {
80
81
  content: string;
81
82
  session_id?: string;
82
83
  space?: string;
84
+ project_id?: string;
83
85
  priority?: Priority;
84
86
  working_dir?: string;
85
87
  repository?: string;
@@ -97,6 +99,7 @@ export interface ReadMessagesOptions {
97
99
  from?: string;
98
100
  to?: string;
99
101
  space?: string;
102
+ project_id?: string;
100
103
  since?: string;
101
104
  since_id?: number;
102
105
  limit?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {