@hasna/conversations 0.2.41 → 0.2.42

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 CHANGED
@@ -14934,7 +14934,7 @@ var init_presence = __esm(() => {
14934
14934
  var require_package = __commonJS((exports, module) => {
14935
14935
  module.exports = {
14936
14936
  name: "@hasna/conversations",
14937
- version: "0.2.41",
14937
+ version: "0.2.42",
14938
14938
  description: "Real-time CLI messaging for AI agents",
14939
14939
  type: "module",
14940
14940
  bin: {
@@ -45615,16 +45615,24 @@ var init_projects2 = __esm(() => {
45615
45615
  });
45616
45616
 
45617
45617
  // src/mcp/channel.ts
45618
- function setSessionAgent(agentId) {
45618
+ function setSessionAgent(agentId, claudeSessionId) {
45619
45619
  sessionAgentId = agentId;
45620
+ if (claudeSessionId)
45621
+ sessionClaudeId = claudeSessionId;
45620
45622
  try {
45621
45623
  const { updateCachedAutoName: updateCachedAutoName2 } = (init_identity(), __toCommonJS(exports_identity));
45622
45624
  updateCachedAutoName2(agentId);
45623
45625
  } catch {}
45624
45626
  }
45627
+ function setClaudeSessionId(id) {
45628
+ sessionClaudeId = id;
45629
+ }
45625
45630
  function getSessionAgent() {
45626
45631
  return sessionAgentId || process.env.CONVERSATIONS_AGENT_ID || null;
45627
45632
  }
45633
+ function getClaudeSessionId() {
45634
+ return sessionClaudeId || process.env.CONVERSATIONS_SESSION_ID || null;
45635
+ }
45628
45636
  function registerChannelBridge(server) {
45629
45637
  server.server.registerCapabilities({
45630
45638
  experimental: { "claude/channel": {} }
@@ -45633,7 +45641,7 @@ function registerChannelBridge(server) {
45633
45641
  let lastSessionMsgId = 0;
45634
45642
  let pollTimer = null;
45635
45643
  function getSessionId() {
45636
- return process.env.CONVERSATIONS_SESSION_ID || null;
45644
+ return getClaudeSessionId();
45637
45645
  }
45638
45646
  function seedLastSeen() {
45639
45647
  const agent = getSessionAgent();
@@ -45655,10 +45663,12 @@ function registerChannelBridge(server) {
45655
45663
  markReadByIds([msg.id]);
45656
45664
  } catch {}
45657
45665
  }
45666
+ const senderSession = msg.session_id;
45667
+ const replyHint = `To reply, use conversations send_message with to="${msg.from_agent}". For direct session injection, use send_to_session with target_session_id from the sender's session.`;
45658
45668
  const enrichedContent = `${msg.content}
45659
45669
 
45660
45670
  ---
45661
- [Via Conversations MCP from ${msg.from_agent} (message #${msg.id}). To reply, use the conversations send_message tool with to="${msg.from_agent}"]`;
45671
+ [Via Conversations from ${msg.from_agent} (msg #${msg.id}). ${replyHint}]`;
45662
45672
  server.server.notification({
45663
45673
  method: "notifications/claude/channel",
45664
45674
  params: {
@@ -45701,7 +45711,7 @@ function registerChannelBridge(server) {
45701
45711
  }
45702
45712
  setTimeout(() => startPolling2(), 2000);
45703
45713
  }
45704
- var POLL_INTERVAL_MS = 1000, sessionAgentId = null;
45714
+ var POLL_INTERVAL_MS = 1000, sessionAgentId = null, sessionClaudeId = null;
45705
45715
  var init_channel = __esm(() => {
45706
45716
  init_messages();
45707
45717
  });
@@ -45723,10 +45733,13 @@ function registerAgentTools(server, agentFocus, getAgentFocus) {
45723
45733
  const name = nameParam || agent_name || agent_id;
45724
45734
  if (!name)
45725
45735
  return { content: [{ type: "text", text: "Error: name is required" }], isError: true };
45726
- const session_id = manualSid || process.env.CONVERSATIONS_SESSION_ID || `${name}-${Date.now()}`;
45736
+ const claudeSid = process.env.CONVERSATIONS_SESSION_ID || null;
45737
+ const session_id = manualSid || claudeSid || `${name}-${Date.now()}`;
45727
45738
  try {
45728
45739
  const result = registerAgent(name, session_id, role, project_id);
45729
45740
  setSessionAgent(name);
45741
+ if (claudeSid)
45742
+ setClaudeSessionId(claudeSid);
45730
45743
  return {
45731
45744
  content: [{ type: "text", text: JSON.stringify(result) }]
45732
45745
  };
package/bin/mcp.js CHANGED
@@ -42459,16 +42459,25 @@ init_identity();
42459
42459
  // src/mcp/channel.ts
42460
42460
  var POLL_INTERVAL_MS = 1000;
42461
42461
  var sessionAgentId = null;
42462
- function setSessionAgent(agentId) {
42462
+ var sessionClaudeId = null;
42463
+ function setSessionAgent(agentId, claudeSessionId) {
42463
42464
  sessionAgentId = agentId;
42465
+ if (claudeSessionId)
42466
+ sessionClaudeId = claudeSessionId;
42464
42467
  try {
42465
42468
  const { updateCachedAutoName: updateCachedAutoName2 } = (init_identity(), __toCommonJS(exports_identity));
42466
42469
  updateCachedAutoName2(agentId);
42467
42470
  } catch {}
42468
42471
  }
42472
+ function setClaudeSessionId(id) {
42473
+ sessionClaudeId = id;
42474
+ }
42469
42475
  function getSessionAgent() {
42470
42476
  return sessionAgentId || process.env.CONVERSATIONS_AGENT_ID || null;
42471
42477
  }
42478
+ function getClaudeSessionId() {
42479
+ return sessionClaudeId || process.env.CONVERSATIONS_SESSION_ID || null;
42480
+ }
42472
42481
  function registerChannelBridge(server) {
42473
42482
  server.server.registerCapabilities({
42474
42483
  experimental: { "claude/channel": {} }
@@ -42477,7 +42486,7 @@ function registerChannelBridge(server) {
42477
42486
  let lastSessionMsgId = 0;
42478
42487
  let pollTimer = null;
42479
42488
  function getSessionId() {
42480
- return process.env.CONVERSATIONS_SESSION_ID || null;
42489
+ return getClaudeSessionId();
42481
42490
  }
42482
42491
  function seedLastSeen() {
42483
42492
  const agent = getSessionAgent();
@@ -42499,10 +42508,12 @@ function registerChannelBridge(server) {
42499
42508
  markReadByIds([msg.id]);
42500
42509
  } catch {}
42501
42510
  }
42511
+ const senderSession = msg.session_id;
42512
+ const replyHint = `To reply, use conversations send_message with to="${msg.from_agent}". For direct session injection, use send_to_session with target_session_id from the sender's session.`;
42502
42513
  const enrichedContent = `${msg.content}
42503
42514
 
42504
42515
  ---
42505
- [Via Conversations MCP from ${msg.from_agent} (message #${msg.id}). To reply, use the conversations send_message tool with to="${msg.from_agent}"]`;
42516
+ [Via Conversations from ${msg.from_agent} (msg #${msg.id}). ${replyHint}]`;
42506
42517
  server.server.notification({
42507
42518
  method: "notifications/claude/channel",
42508
42519
  params: {
@@ -42563,10 +42574,13 @@ function registerAgentTools(server, agentFocus, getAgentFocus) {
42563
42574
  const name = nameParam || agent_name || agent_id;
42564
42575
  if (!name)
42565
42576
  return { content: [{ type: "text", text: "Error: name is required" }], isError: true };
42566
- const session_id = manualSid || process.env.CONVERSATIONS_SESSION_ID || `${name}-${Date.now()}`;
42577
+ const claudeSid = process.env.CONVERSATIONS_SESSION_ID || null;
42578
+ const session_id = manualSid || claudeSid || `${name}-${Date.now()}`;
42567
42579
  try {
42568
42580
  const result = registerAgent(name, session_id, role, project_id);
42569
42581
  setSessionAgent(name);
42582
+ if (claudeSid)
42583
+ setClaudeSessionId(claudeSid);
42570
42584
  return {
42571
42585
  content: [{ type: "text", text: JSON.stringify(result) }]
42572
42586
  };
@@ -44446,7 +44460,7 @@ function registerTmuxTools(server) {
44446
44460
  // package.json
44447
44461
  var package_default = {
44448
44462
  name: "@hasna/conversations",
44449
- version: "0.2.41",
44463
+ version: "0.2.42",
44450
44464
  description: "Real-time CLI messaging for AI agents",
44451
44465
  type: "module",
44452
44466
  bin: {
@@ -16,6 +16,9 @@
16
16
  */
17
17
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
18
18
  /** Called by agent tools when register_agent or heartbeat fires */
19
- export declare function setSessionAgent(agentId: string): void;
19
+ export declare function setSessionAgent(agentId: string, claudeSessionId?: string): void;
20
+ /** Called by register_agent to store the claude session ID */
21
+ export declare function setClaudeSessionId(id: string): void;
20
22
  export declare function getSessionAgent(): string | null;
23
+ export declare function getClaudeSessionId(): string | null;
21
24
  export declare function registerChannelBridge(server: McpServer): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {