@hasna/conversations 0.2.10 → 0.2.12

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.
Files changed (3) hide show
  1. package/bin/index.js +63 -1
  2. package/bin/mcp.js +63 -1
  3. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -4442,7 +4442,7 @@ var init_poll = __esm(() => {
4442
4442
  var require_package = __commonJS((exports, module) => {
4443
4443
  module.exports = {
4444
4444
  name: "@hasna/conversations",
4445
- version: "0.2.10",
4445
+ version: "0.2.12",
4446
4446
  description: "Real-time CLI messaging for AI agents",
4447
4447
  type: "module",
4448
4448
  bin: {
@@ -34522,6 +34522,68 @@ var init_mcp2 = __esm(() => {
34522
34522
  const reactions = getReactions(args.message_id);
34523
34523
  return { content: [{ type: "text", text: JSON.stringify(reactions) }] };
34524
34524
  });
34525
+ server.registerTool("summarize_space", {
34526
+ description: "Get a structured catch-up summary of a space for a time window \u2014 participants, topics, key messages, blockers, activity counts. No LLM required.",
34527
+ inputSchema: {
34528
+ space: exports_external.string().describe("Space name"),
34529
+ since: exports_external.string().optional().describe("ISO 8601 timestamp \u2014 only include messages after this. Defaults to 24h ago."),
34530
+ limit: exports_external.coerce.number().optional().describe("Max messages to analyze (default: 100)")
34531
+ }
34532
+ }, async (args) => {
34533
+ const { space, since, limit } = args;
34534
+ const sinceTs = since ?? new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
34535
+ const db2 = (await Promise.resolve().then(() => (init_db(), exports_db))).getDb();
34536
+ const total = db2.prepare("SELECT COUNT(*) as c FROM messages WHERE space = ? AND created_at >= ?").get(space, sinceTs).c;
34537
+ if (total === 0) {
34538
+ return { content: [{ type: "text", text: `No messages in #${space} since ${sinceTs.slice(0, 10)}.` }] };
34539
+ }
34540
+ const rows = db2.prepare(`SELECT * FROM messages WHERE space = ? AND created_at >= ? ORDER BY created_at DESC LIMIT ?`).all(space, sinceTs, limit ?? 100);
34541
+ const agents = new Set;
34542
+ const agentCounts = {};
34543
+ const blockers = [];
34544
+ const mentions = {};
34545
+ for (const m of rows) {
34546
+ const from = m.from_agent;
34547
+ agents.add(from);
34548
+ agentCounts[from] = (agentCounts[from] ?? 0) + 1;
34549
+ if (m.blocking) {
34550
+ blockers.push({ id: m.id, from, content: m.content.slice(0, 150), created_at: m.created_at });
34551
+ }
34552
+ const mentionedAgents = m.content.match(/@([a-zA-Z0-9_-]+)/g) ?? [];
34553
+ for (const mention of mentionedAgents) {
34554
+ const a = mention.slice(1).toLowerCase();
34555
+ mentions[a] = (mentions[a] ?? 0) + 1;
34556
+ }
34557
+ }
34558
+ const parts = [
34559
+ `Space: #${space} | Since: ${sinceTs.slice(0, 10)} | ${total} messages (showing ${rows.length})`,
34560
+ `
34561
+ Participants (${agents.size}): ${Object.entries(agentCounts).sort((a, b) => b[1] - a[1]).map(([n, c]) => `${n}(${c})`).join(", ")}`
34562
+ ];
34563
+ if (Object.keys(mentions).length > 0) {
34564
+ const topMentions = Object.entries(mentions).sort((a, b) => b[1] - a[1]).slice(0, 5);
34565
+ parts.push(`Most mentioned: ${topMentions.map(([n, c]) => `@${n}(${c})`).join(", ")}`);
34566
+ }
34567
+ if (blockers.length > 0) {
34568
+ parts.push(`
34569
+ \u26D4 ${blockers.length} blocking message(s):`);
34570
+ for (const b of blockers.slice(0, 5)) {
34571
+ parts.push(` \u2022 [#${b.id}] ${b.from}: ${b.content}${b.content.length > 150 ? "..." : ""}`);
34572
+ }
34573
+ }
34574
+ const highPri = rows.filter((m) => m.priority === "high" || m.priority === "urgent").slice(0, 5);
34575
+ if (highPri.length > 0) {
34576
+ parts.push(`
34577
+ \uD83D\uDD34 High priority (${highPri.length}):`);
34578
+ for (const m of highPri) {
34579
+ parts.push(` \u2022 [${m.priority}] ${m.from_agent}: ${m.content.slice(0, 100)}`);
34580
+ }
34581
+ }
34582
+ parts.push(`
34583
+ Last message: ${rows[0]?.created_at?.slice(0, 16) ?? "?"}`);
34584
+ return { content: [{ type: "text", text: parts.join(`
34585
+ `) }] };
34586
+ });
34525
34587
  server.registerTool("get_reaction_summary", {
34526
34588
  description: "Get emoji reaction counts and agent lists for a message.",
34527
34589
  inputSchema: {
package/bin/mcp.js CHANGED
@@ -30932,7 +30932,7 @@ function getGraphStats() {
30932
30932
  // package.json
30933
30933
  var package_default = {
30934
30934
  name: "@hasna/conversations",
30935
- version: "0.2.10",
30935
+ version: "0.2.12",
30936
30936
  description: "Real-time CLI messaging for AI agents",
30937
30937
  type: "module",
30938
30938
  bin: {
@@ -31891,6 +31891,68 @@ server.registerTool("get_reactions", {
31891
31891
  const reactions = getReactions(args.message_id);
31892
31892
  return { content: [{ type: "text", text: JSON.stringify(reactions) }] };
31893
31893
  });
31894
+ server.registerTool("summarize_space", {
31895
+ description: "Get a structured catch-up summary of a space for a time window \u2014 participants, topics, key messages, blockers, activity counts. No LLM required.",
31896
+ inputSchema: {
31897
+ space: exports_external.string().describe("Space name"),
31898
+ since: exports_external.string().optional().describe("ISO 8601 timestamp \u2014 only include messages after this. Defaults to 24h ago."),
31899
+ limit: exports_external.coerce.number().optional().describe("Max messages to analyze (default: 100)")
31900
+ }
31901
+ }, async (args) => {
31902
+ const { space, since, limit } = args;
31903
+ const sinceTs = since ?? new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
31904
+ const db2 = (await Promise.resolve().then(() => (init_db(), exports_db))).getDb();
31905
+ const total = db2.prepare("SELECT COUNT(*) as c FROM messages WHERE space = ? AND created_at >= ?").get(space, sinceTs).c;
31906
+ if (total === 0) {
31907
+ return { content: [{ type: "text", text: `No messages in #${space} since ${sinceTs.slice(0, 10)}.` }] };
31908
+ }
31909
+ const rows = db2.prepare(`SELECT * FROM messages WHERE space = ? AND created_at >= ? ORDER BY created_at DESC LIMIT ?`).all(space, sinceTs, limit ?? 100);
31910
+ const agents = new Set;
31911
+ const agentCounts = {};
31912
+ const blockers = [];
31913
+ const mentions = {};
31914
+ for (const m of rows) {
31915
+ const from = m.from_agent;
31916
+ agents.add(from);
31917
+ agentCounts[from] = (agentCounts[from] ?? 0) + 1;
31918
+ if (m.blocking) {
31919
+ blockers.push({ id: m.id, from, content: m.content.slice(0, 150), created_at: m.created_at });
31920
+ }
31921
+ const mentionedAgents = m.content.match(/@([a-zA-Z0-9_-]+)/g) ?? [];
31922
+ for (const mention of mentionedAgents) {
31923
+ const a = mention.slice(1).toLowerCase();
31924
+ mentions[a] = (mentions[a] ?? 0) + 1;
31925
+ }
31926
+ }
31927
+ const parts = [
31928
+ `Space: #${space} | Since: ${sinceTs.slice(0, 10)} | ${total} messages (showing ${rows.length})`,
31929
+ `
31930
+ Participants (${agents.size}): ${Object.entries(agentCounts).sort((a, b) => b[1] - a[1]).map(([n, c]) => `${n}(${c})`).join(", ")}`
31931
+ ];
31932
+ if (Object.keys(mentions).length > 0) {
31933
+ const topMentions = Object.entries(mentions).sort((a, b) => b[1] - a[1]).slice(0, 5);
31934
+ parts.push(`Most mentioned: ${topMentions.map(([n, c]) => `@${n}(${c})`).join(", ")}`);
31935
+ }
31936
+ if (blockers.length > 0) {
31937
+ parts.push(`
31938
+ \u26D4 ${blockers.length} blocking message(s):`);
31939
+ for (const b of blockers.slice(0, 5)) {
31940
+ parts.push(` \u2022 [#${b.id}] ${b.from}: ${b.content}${b.content.length > 150 ? "..." : ""}`);
31941
+ }
31942
+ }
31943
+ const highPri = rows.filter((m) => m.priority === "high" || m.priority === "urgent").slice(0, 5);
31944
+ if (highPri.length > 0) {
31945
+ parts.push(`
31946
+ \uD83D\uDD34 High priority (${highPri.length}):`);
31947
+ for (const m of highPri) {
31948
+ parts.push(` \u2022 [${m.priority}] ${m.from_agent}: ${m.content.slice(0, 100)}`);
31949
+ }
31950
+ }
31951
+ parts.push(`
31952
+ Last message: ${rows[0]?.created_at?.slice(0, 16) ?? "?"}`);
31953
+ return { content: [{ type: "text", text: parts.join(`
31954
+ `) }] };
31955
+ });
31894
31956
  server.registerTool("get_reaction_summary", {
31895
31957
  description: "Get emoji reaction counts and agent lists for a message.",
31896
31958
  inputSchema: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {