@hasna/conversations 0.2.6 → 0.2.7
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 +33 -10
- package/bin/mcp.js +33 -10
- package/dist/index.js +16 -0
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -2646,6 +2646,14 @@ function searchMessages(opts) {
|
|
|
2646
2646
|
extraWhere += " AND m.to_agent = ?";
|
|
2647
2647
|
ftsParams.push(opts.to);
|
|
2648
2648
|
}
|
|
2649
|
+
if (opts.since) {
|
|
2650
|
+
extraWhere += " AND m.created_at >= ?";
|
|
2651
|
+
ftsParams.push(opts.since);
|
|
2652
|
+
}
|
|
2653
|
+
if (opts.until) {
|
|
2654
|
+
extraWhere += " AND m.created_at <= ?";
|
|
2655
|
+
ftsParams.push(opts.until);
|
|
2656
|
+
}
|
|
2649
2657
|
const orderClause = sortByRelevance ? "ORDER BY rank" : "ORDER BY m.created_at DESC, m.id DESC";
|
|
2650
2658
|
const rows2 = db2.prepare(`SELECT m.*, rank,
|
|
2651
2659
|
snippet(messages_fts, 0, '**', '**', '...', 20) as snippet
|
|
@@ -2678,6 +2686,14 @@ function searchMessages(opts) {
|
|
|
2678
2686
|
conditions.push("to_agent = ?");
|
|
2679
2687
|
params.push(opts.to);
|
|
2680
2688
|
}
|
|
2689
|
+
if (opts.since) {
|
|
2690
|
+
conditions.push("created_at >= ?");
|
|
2691
|
+
params.push(opts.since);
|
|
2692
|
+
}
|
|
2693
|
+
if (opts.until) {
|
|
2694
|
+
conditions.push("created_at <= ?");
|
|
2695
|
+
params.push(opts.until);
|
|
2696
|
+
}
|
|
2681
2697
|
const where = `WHERE ${conditions.join(" AND ")}`;
|
|
2682
2698
|
const rows = db2.prepare(`SELECT * FROM messages ${where} ORDER BY created_at DESC, id DESC LIMIT ${limit}`).all(...params);
|
|
2683
2699
|
return rows.map((row) => {
|
|
@@ -4424,7 +4440,7 @@ var init_poll = __esm(() => {
|
|
|
4424
4440
|
var require_package = __commonJS((exports, module) => {
|
|
4425
4441
|
module.exports = {
|
|
4426
4442
|
name: "@hasna/conversations",
|
|
4427
|
-
version: "0.2.
|
|
4443
|
+
version: "0.2.7",
|
|
4428
4444
|
description: "Real-time CLI messaging for AI agents",
|
|
4429
4445
|
type: "module",
|
|
4430
4446
|
bin: {
|
|
@@ -33763,19 +33779,26 @@ var init_mcp2 = __esm(() => {
|
|
|
33763
33779
|
};
|
|
33764
33780
|
});
|
|
33765
33781
|
server.registerTool("search_messages", {
|
|
33766
|
-
description: "Full-text search across messages.",
|
|
33782
|
+
description: "Full-text search across messages. Uses FTS5 with BM25 ranking if available, falls back to LIKE. Returns messages with snippet and relevance_score.",
|
|
33767
33783
|
inputSchema: {
|
|
33768
|
-
query: exports_external.string(),
|
|
33769
|
-
space: exports_external.string().optional(),
|
|
33770
|
-
from: exports_external.string().optional(),
|
|
33771
|
-
to: exports_external.string().optional(),
|
|
33772
|
-
|
|
33784
|
+
query: exports_external.string().describe(`Search query. Wrap in quotes for exact phrase: '"BUG-005"'`),
|
|
33785
|
+
space: exports_external.string().optional().describe("Limit to a specific space"),
|
|
33786
|
+
from: exports_external.string().optional().describe("Filter by sender"),
|
|
33787
|
+
to: exports_external.string().optional().describe("Filter by recipient"),
|
|
33788
|
+
since: exports_external.string().optional().describe("ISO 8601 date \u2014 only messages after this"),
|
|
33789
|
+
until: exports_external.string().optional().describe("ISO 8601 date \u2014 only messages before this"),
|
|
33790
|
+
sort: exports_external.enum(["relevance", "recent"]).optional().describe("Sort order (default: relevance)"),
|
|
33791
|
+
limit: exports_external.coerce.number().optional().describe("Max results (default: 20)")
|
|
33773
33792
|
}
|
|
33774
33793
|
}, async (args) => {
|
|
33775
|
-
const { query, space, from, to, limit } = args;
|
|
33776
|
-
const
|
|
33794
|
+
const { query, space, from, to, since, until, sort, limit } = args;
|
|
33795
|
+
const results = searchMessages({ query, space, from, to, since, until, sort, limit });
|
|
33777
33796
|
return {
|
|
33778
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
33797
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
33798
|
+
results,
|
|
33799
|
+
count: results.length,
|
|
33800
|
+
query
|
|
33801
|
+
}) }]
|
|
33779
33802
|
};
|
|
33780
33803
|
});
|
|
33781
33804
|
server.registerTool("export_messages", {
|
package/bin/mcp.js
CHANGED
|
@@ -29143,6 +29143,14 @@ function searchMessages(opts) {
|
|
|
29143
29143
|
extraWhere += " AND m.to_agent = ?";
|
|
29144
29144
|
ftsParams.push(opts.to);
|
|
29145
29145
|
}
|
|
29146
|
+
if (opts.since) {
|
|
29147
|
+
extraWhere += " AND m.created_at >= ?";
|
|
29148
|
+
ftsParams.push(opts.since);
|
|
29149
|
+
}
|
|
29150
|
+
if (opts.until) {
|
|
29151
|
+
extraWhere += " AND m.created_at <= ?";
|
|
29152
|
+
ftsParams.push(opts.until);
|
|
29153
|
+
}
|
|
29146
29154
|
const orderClause = sortByRelevance ? "ORDER BY rank" : "ORDER BY m.created_at DESC, m.id DESC";
|
|
29147
29155
|
const rows2 = db2.prepare(`SELECT m.*, rank,
|
|
29148
29156
|
snippet(messages_fts, 0, '**', '**', '...', 20) as snippet
|
|
@@ -29175,6 +29183,14 @@ function searchMessages(opts) {
|
|
|
29175
29183
|
conditions.push("to_agent = ?");
|
|
29176
29184
|
params.push(opts.to);
|
|
29177
29185
|
}
|
|
29186
|
+
if (opts.since) {
|
|
29187
|
+
conditions.push("created_at >= ?");
|
|
29188
|
+
params.push(opts.since);
|
|
29189
|
+
}
|
|
29190
|
+
if (opts.until) {
|
|
29191
|
+
conditions.push("created_at <= ?");
|
|
29192
|
+
params.push(opts.until);
|
|
29193
|
+
}
|
|
29178
29194
|
const where = `WHERE ${conditions.join(" AND ")}`;
|
|
29179
29195
|
const rows = db2.prepare(`SELECT * FROM messages ${where} ORDER BY created_at DESC, id DESC LIMIT ${limit}`).all(...params);
|
|
29180
29196
|
return rows.map((row) => {
|
|
@@ -30908,7 +30924,7 @@ function getGraphStats() {
|
|
|
30908
30924
|
// package.json
|
|
30909
30925
|
var package_default = {
|
|
30910
30926
|
name: "@hasna/conversations",
|
|
30911
|
-
version: "0.2.
|
|
30927
|
+
version: "0.2.7",
|
|
30912
30928
|
description: "Real-time CLI messaging for AI agents",
|
|
30913
30929
|
type: "module",
|
|
30914
30930
|
bin: {
|
|
@@ -31126,19 +31142,26 @@ server.registerTool("mark_read", {
|
|
|
31126
31142
|
};
|
|
31127
31143
|
});
|
|
31128
31144
|
server.registerTool("search_messages", {
|
|
31129
|
-
description: "Full-text search across messages.",
|
|
31145
|
+
description: "Full-text search across messages. Uses FTS5 with BM25 ranking if available, falls back to LIKE. Returns messages with snippet and relevance_score.",
|
|
31130
31146
|
inputSchema: {
|
|
31131
|
-
query: exports_external.string(),
|
|
31132
|
-
space: exports_external.string().optional(),
|
|
31133
|
-
from: exports_external.string().optional(),
|
|
31134
|
-
to: exports_external.string().optional(),
|
|
31135
|
-
|
|
31147
|
+
query: exports_external.string().describe(`Search query. Wrap in quotes for exact phrase: '"BUG-005"'`),
|
|
31148
|
+
space: exports_external.string().optional().describe("Limit to a specific space"),
|
|
31149
|
+
from: exports_external.string().optional().describe("Filter by sender"),
|
|
31150
|
+
to: exports_external.string().optional().describe("Filter by recipient"),
|
|
31151
|
+
since: exports_external.string().optional().describe("ISO 8601 date \u2014 only messages after this"),
|
|
31152
|
+
until: exports_external.string().optional().describe("ISO 8601 date \u2014 only messages before this"),
|
|
31153
|
+
sort: exports_external.enum(["relevance", "recent"]).optional().describe("Sort order (default: relevance)"),
|
|
31154
|
+
limit: exports_external.coerce.number().optional().describe("Max results (default: 20)")
|
|
31136
31155
|
}
|
|
31137
31156
|
}, async (args) => {
|
|
31138
|
-
const { query, space, from, to, limit } = args;
|
|
31139
|
-
const
|
|
31157
|
+
const { query, space, from, to, since, until, sort, limit } = args;
|
|
31158
|
+
const results = searchMessages({ query, space, from, to, since, until, sort, limit });
|
|
31140
31159
|
return {
|
|
31141
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
31160
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
31161
|
+
results,
|
|
31162
|
+
count: results.length,
|
|
31163
|
+
query
|
|
31164
|
+
}) }]
|
|
31142
31165
|
};
|
|
31143
31166
|
});
|
|
31144
31167
|
server.registerTool("export_messages", {
|
package/dist/index.js
CHANGED
|
@@ -2568,6 +2568,14 @@ function searchMessages(opts) {
|
|
|
2568
2568
|
extraWhere += " AND m.to_agent = ?";
|
|
2569
2569
|
ftsParams.push(opts.to);
|
|
2570
2570
|
}
|
|
2571
|
+
if (opts.since) {
|
|
2572
|
+
extraWhere += " AND m.created_at >= ?";
|
|
2573
|
+
ftsParams.push(opts.since);
|
|
2574
|
+
}
|
|
2575
|
+
if (opts.until) {
|
|
2576
|
+
extraWhere += " AND m.created_at <= ?";
|
|
2577
|
+
ftsParams.push(opts.until);
|
|
2578
|
+
}
|
|
2571
2579
|
const orderClause = sortByRelevance ? "ORDER BY rank" : "ORDER BY m.created_at DESC, m.id DESC";
|
|
2572
2580
|
const rows2 = db2.prepare(`SELECT m.*, rank,
|
|
2573
2581
|
snippet(messages_fts, 0, '**', '**', '...', 20) as snippet
|
|
@@ -2600,6 +2608,14 @@ function searchMessages(opts) {
|
|
|
2600
2608
|
conditions.push("to_agent = ?");
|
|
2601
2609
|
params.push(opts.to);
|
|
2602
2610
|
}
|
|
2611
|
+
if (opts.since) {
|
|
2612
|
+
conditions.push("created_at >= ?");
|
|
2613
|
+
params.push(opts.since);
|
|
2614
|
+
}
|
|
2615
|
+
if (opts.until) {
|
|
2616
|
+
conditions.push("created_at <= ?");
|
|
2617
|
+
params.push(opts.until);
|
|
2618
|
+
}
|
|
2603
2619
|
const where = `WHERE ${conditions.join(" AND ")}`;
|
|
2604
2620
|
const rows = db2.prepare(`SELECT * FROM messages ${where} ORDER BY created_at DESC, id DESC LIMIT ${limit}`).all(...params);
|
|
2605
2621
|
return rows.map((row) => {
|
package/dist/types.d.ts
CHANGED
|
@@ -118,8 +118,11 @@ export interface SearchMessagesOptions {
|
|
|
118
118
|
space?: string;
|
|
119
119
|
from?: string;
|
|
120
120
|
to?: string;
|
|
121
|
+
since?: string;
|
|
122
|
+
until?: string;
|
|
121
123
|
limit?: number;
|
|
122
124
|
sort?: "relevance" | "recent";
|
|
125
|
+
snippet_length?: number;
|
|
123
126
|
}
|
|
124
127
|
export interface SearchResult extends Message {
|
|
125
128
|
snippet: string | null;
|