@hasna/conversations 0.2.7 → 0.2.8
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 +10 -7
- package/bin/mcp.js +10 -7
- package/dist/index.js +3 -2
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -2395,9 +2395,10 @@ function readMessages(opts = {}) {
|
|
|
2395
2395
|
conditions.push(`id IN (SELECT message_id FROM message_mentions WHERE mentioned_agent = ?)`);
|
|
2396
2396
|
params.push(opts.mentions_only.toLowerCase());
|
|
2397
2397
|
}
|
|
2398
|
+
const isLatest = opts.latest && opts.latest > 0;
|
|
2398
2399
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
2399
|
-
const resolvedLimit = Number.isFinite(opts.limit) && opts.limit > 0 ? Math.floor(opts.limit) : 20;
|
|
2400
|
-
const order = opts.order?.toLowerCase() === "desc" ? "DESC" : "ASC";
|
|
2400
|
+
const resolvedLimit = isLatest ? Math.floor(opts.latest) : Number.isFinite(opts.limit) && opts.limit > 0 ? Math.floor(opts.limit) : 20;
|
|
2401
|
+
const order = isLatest ? "DESC" : opts.order?.toLowerCase() === "desc" ? "DESC" : "ASC";
|
|
2401
2402
|
const rows = db2.prepare(`SELECT * FROM messages ${where} ORDER BY created_at ${order}, id ${order} LIMIT ${resolvedLimit}`).all(...params);
|
|
2402
2403
|
let messages = rows.map(parseMessage);
|
|
2403
2404
|
if (opts.include_reply_counts && messages.length > 0) {
|
|
@@ -4440,7 +4441,7 @@ var init_poll = __esm(() => {
|
|
|
4440
4441
|
var require_package = __commonJS((exports, module) => {
|
|
4441
4442
|
module.exports = {
|
|
4442
4443
|
name: "@hasna/conversations",
|
|
4443
|
-
version: "0.2.
|
|
4444
|
+
version: "0.2.8",
|
|
4444
4445
|
description: "Real-time CLI messaging for AI agents",
|
|
4445
4446
|
type: "module",
|
|
4446
4447
|
bin: {
|
|
@@ -33696,7 +33697,8 @@ var init_mcp2 = __esm(() => {
|
|
|
33696
33697
|
max_content_length: exports_external.coerce.number().optional().describe("Truncate each message content to N chars (adds truncated:true flag)"),
|
|
33697
33698
|
threads_only: exports_external.coerce.boolean().optional().describe("Only return root messages (reply_to IS NULL) \u2014 hides thread replies"),
|
|
33698
33699
|
include_reply_counts: exports_external.coerce.boolean().optional().describe("Include reply_count on each message (adds one extra query)"),
|
|
33699
|
-
mentions_only: exports_external.string().optional().describe("Only return messages that @mention this agent")
|
|
33700
|
+
mentions_only: exports_external.string().optional().describe("Only return messages that @mention this agent"),
|
|
33701
|
+
latest: exports_external.coerce.number().optional().describe("Return the N most recent unread messages, newest first. Shorthand for order:desc + limit:N.")
|
|
33700
33702
|
}
|
|
33701
33703
|
}, async (args) => {
|
|
33702
33704
|
const agent = resolveIdentity(args.from);
|
|
@@ -33953,11 +33955,12 @@ var init_mcp2 = __esm(() => {
|
|
|
33953
33955
|
mark_read: exports_external.coerce.boolean().optional(),
|
|
33954
33956
|
max_content_length: exports_external.coerce.number().optional().describe("Truncate each message content to N chars (adds truncated:true flag)"),
|
|
33955
33957
|
threads_only: exports_external.coerce.boolean().optional().describe("Only return root messages (hides thread replies)"),
|
|
33956
|
-
include_reply_counts: exports_external.coerce.boolean().optional().describe("Include reply_count on each message")
|
|
33958
|
+
include_reply_counts: exports_external.coerce.boolean().optional().describe("Include reply_count on each message"),
|
|
33959
|
+
latest: exports_external.coerce.number().optional().describe("Return the N most recent messages, newest first")
|
|
33957
33960
|
}
|
|
33958
33961
|
}, async (args) => {
|
|
33959
|
-
const { space, since, limit, mark_read, max_content_length, threads_only, include_reply_counts } = args;
|
|
33960
|
-
const messages = readMessages({ space, since, limit, max_content_length, threads_only, include_reply_counts });
|
|
33962
|
+
const { space, since, limit, mark_read, max_content_length, threads_only, include_reply_counts, latest } = args;
|
|
33963
|
+
const messages = readMessages({ space, since, limit, max_content_length, threads_only, include_reply_counts, latest });
|
|
33961
33964
|
if (mark_read !== false && messages.length > 0) {
|
|
33962
33965
|
markReadByIds(messages.map((m) => m.id));
|
|
33963
33966
|
}
|
package/bin/mcp.js
CHANGED
|
@@ -28904,9 +28904,10 @@ function readMessages(opts = {}) {
|
|
|
28904
28904
|
conditions.push(`id IN (SELECT message_id FROM message_mentions WHERE mentioned_agent = ?)`);
|
|
28905
28905
|
params.push(opts.mentions_only.toLowerCase());
|
|
28906
28906
|
}
|
|
28907
|
+
const isLatest = opts.latest && opts.latest > 0;
|
|
28907
28908
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
28908
|
-
const resolvedLimit = Number.isFinite(opts.limit) && opts.limit > 0 ? Math.floor(opts.limit) : 20;
|
|
28909
|
-
const order = opts.order?.toLowerCase() === "desc" ? "DESC" : "ASC";
|
|
28909
|
+
const resolvedLimit = isLatest ? Math.floor(opts.latest) : Number.isFinite(opts.limit) && opts.limit > 0 ? Math.floor(opts.limit) : 20;
|
|
28910
|
+
const order = isLatest ? "DESC" : opts.order?.toLowerCase() === "desc" ? "DESC" : "ASC";
|
|
28910
28911
|
const rows = db2.prepare(`SELECT * FROM messages ${where} ORDER BY created_at ${order}, id ${order} LIMIT ${resolvedLimit}`).all(...params);
|
|
28911
28912
|
let messages = rows.map(parseMessage);
|
|
28912
28913
|
if (opts.include_reply_counts && messages.length > 0) {
|
|
@@ -30924,7 +30925,7 @@ function getGraphStats() {
|
|
|
30924
30925
|
// package.json
|
|
30925
30926
|
var package_default = {
|
|
30926
30927
|
name: "@hasna/conversations",
|
|
30927
|
-
version: "0.2.
|
|
30928
|
+
version: "0.2.8",
|
|
30928
30929
|
description: "Real-time CLI messaging for AI agents",
|
|
30929
30930
|
type: "module",
|
|
30930
30931
|
bin: {
|
|
@@ -31059,7 +31060,8 @@ server.registerTool("read_messages", {
|
|
|
31059
31060
|
max_content_length: exports_external.coerce.number().optional().describe("Truncate each message content to N chars (adds truncated:true flag)"),
|
|
31060
31061
|
threads_only: exports_external.coerce.boolean().optional().describe("Only return root messages (reply_to IS NULL) \u2014 hides thread replies"),
|
|
31061
31062
|
include_reply_counts: exports_external.coerce.boolean().optional().describe("Include reply_count on each message (adds one extra query)"),
|
|
31062
|
-
mentions_only: exports_external.string().optional().describe("Only return messages that @mention this agent")
|
|
31063
|
+
mentions_only: exports_external.string().optional().describe("Only return messages that @mention this agent"),
|
|
31064
|
+
latest: exports_external.coerce.number().optional().describe("Return the N most recent unread messages, newest first. Shorthand for order:desc + limit:N.")
|
|
31063
31065
|
}
|
|
31064
31066
|
}, async (args) => {
|
|
31065
31067
|
const agent = resolveIdentity(args.from);
|
|
@@ -31316,11 +31318,12 @@ server.registerTool("read_space", {
|
|
|
31316
31318
|
mark_read: exports_external.coerce.boolean().optional(),
|
|
31317
31319
|
max_content_length: exports_external.coerce.number().optional().describe("Truncate each message content to N chars (adds truncated:true flag)"),
|
|
31318
31320
|
threads_only: exports_external.coerce.boolean().optional().describe("Only return root messages (hides thread replies)"),
|
|
31319
|
-
include_reply_counts: exports_external.coerce.boolean().optional().describe("Include reply_count on each message")
|
|
31321
|
+
include_reply_counts: exports_external.coerce.boolean().optional().describe("Include reply_count on each message"),
|
|
31322
|
+
latest: exports_external.coerce.number().optional().describe("Return the N most recent messages, newest first")
|
|
31320
31323
|
}
|
|
31321
31324
|
}, async (args) => {
|
|
31322
|
-
const { space, since, limit, mark_read, max_content_length, threads_only, include_reply_counts } = args;
|
|
31323
|
-
const messages = readMessages({ space, since, limit, max_content_length, threads_only, include_reply_counts });
|
|
31325
|
+
const { space, since, limit, mark_read, max_content_length, threads_only, include_reply_counts, latest } = args;
|
|
31326
|
+
const messages = readMessages({ space, since, limit, max_content_length, threads_only, include_reply_counts, latest });
|
|
31324
31327
|
if (mark_read !== false && messages.length > 0) {
|
|
31325
31328
|
markReadByIds(messages.map((m) => m.id));
|
|
31326
31329
|
}
|
package/dist/index.js
CHANGED
|
@@ -2369,9 +2369,10 @@ function readMessages(opts = {}) {
|
|
|
2369
2369
|
conditions.push(`id IN (SELECT message_id FROM message_mentions WHERE mentioned_agent = ?)`);
|
|
2370
2370
|
params.push(opts.mentions_only.toLowerCase());
|
|
2371
2371
|
}
|
|
2372
|
+
const isLatest = opts.latest && opts.latest > 0;
|
|
2372
2373
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
2373
|
-
const resolvedLimit = Number.isFinite(opts.limit) && opts.limit > 0 ? Math.floor(opts.limit) : 20;
|
|
2374
|
-
const order = opts.order?.toLowerCase() === "desc" ? "DESC" : "ASC";
|
|
2374
|
+
const resolvedLimit = isLatest ? Math.floor(opts.latest) : Number.isFinite(opts.limit) && opts.limit > 0 ? Math.floor(opts.limit) : 20;
|
|
2375
|
+
const order = isLatest ? "DESC" : opts.order?.toLowerCase() === "desc" ? "DESC" : "ASC";
|
|
2375
2376
|
const rows = db2.prepare(`SELECT * FROM messages ${where} ORDER BY created_at ${order}, id ${order} LIMIT ${resolvedLimit}`).all(...params);
|
|
2376
2377
|
let messages = rows.map(parseMessage);
|
|
2377
2378
|
if (opts.include_reply_counts && messages.length > 0) {
|
package/dist/types.d.ts
CHANGED