@hasna/conversations 0.1.1 → 0.1.3

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
@@ -2685,7 +2685,7 @@ var init_presence = __esm(() => {
2685
2685
  var require_package = __commonJS((exports, module) => {
2686
2686
  module.exports = {
2687
2687
  name: "@hasna/conversations",
2688
- version: "0.1.1",
2688
+ version: "0.1.3",
2689
2689
  description: "Real-time CLI messaging for AI agents",
2690
2690
  type: "module",
2691
2691
  bin: {
@@ -31627,13 +31627,14 @@ var init_stdio2 = __esm(() => {
31627
31627
  // src/mcp/index.ts
31628
31628
  var exports_mcp = {};
31629
31629
  __export(exports_mcp, {
31630
- startMcpServer: () => startMcpServer
31630
+ startMcpServer: () => startMcpServer,
31631
+ server: () => server
31631
31632
  });
31632
31633
  async function startMcpServer() {
31633
31634
  const transport = new StdioServerTransport;
31634
31635
  await server.connect(transport);
31635
31636
  }
31636
- var server, isDirectRun;
31637
+ var import__package, server, isDirectRun;
31637
31638
  var init_mcp2 = __esm(() => {
31638
31639
  init_mcp();
31639
31640
  init_stdio2();
@@ -31643,14 +31644,16 @@ var init_mcp2 = __esm(() => {
31643
31644
  init_spaces();
31644
31645
  init_projects();
31645
31646
  init_presence();
31647
+ import__package = __toESM(require_package(), 1);
31646
31648
  server = new McpServer({
31647
31649
  name: "conversations",
31648
- version: "0.1.0"
31650
+ version: import__package.default.version
31649
31651
  });
31650
31652
  server.registerTool("send_message", {
31651
31653
  title: "Send Message",
31652
- description: "Send a direct message to another agent. The sender is auto-resolved from CONVERSATIONS_AGENT_ID env var.",
31654
+ description: "Send a direct message to another agent. Pass 'from' to identify yourself, or it falls back to CONVERSATIONS_AGENT_ID env var.",
31653
31655
  inputSchema: {
31656
+ from: exports_external.string().optional().describe("Your agent ID (e.g. 'claude-1', 'assistant'). Falls back to CONVERSATIONS_AGENT_ID env var."),
31654
31657
  to: exports_external.string().describe("Recipient agent ID"),
31655
31658
  content: exports_external.string().describe("Message content"),
31656
31659
  session_id: exports_external.string().optional().describe("Session ID (auto-generated if omitted)"),
@@ -31660,8 +31663,8 @@ var init_mcp2 = __esm(() => {
31660
31663
  branch: exports_external.string().optional().describe("Branch context"),
31661
31664
  metadata: exports_external.string().optional().describe("JSON metadata string")
31662
31665
  }
31663
- }, async ({ to, content, session_id, priority, working_dir, repository, branch, metadata }) => {
31664
- const from = resolveIdentity();
31666
+ }, async ({ from: fromParam, to, content, session_id, priority, working_dir, repository, branch, metadata }) => {
31667
+ const from = resolveIdentity(fromParam);
31665
31668
  let parsedMetadata;
31666
31669
  if (metadata) {
31667
31670
  try {
@@ -31722,11 +31725,12 @@ var init_mcp2 = __esm(() => {
31722
31725
  title: "Reply to Message",
31723
31726
  description: "Reply to a message by its ID. Automatically uses the same session and sends to the original sender.",
31724
31727
  inputSchema: {
31728
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
31725
31729
  message_id: exports_external.number().describe("ID of the message to reply to"),
31726
31730
  content: exports_external.string().describe("Reply content"),
31727
31731
  priority: exports_external.enum(["low", "normal", "high", "urgent"]).optional().describe("Message priority")
31728
31732
  }
31729
- }, async ({ message_id, content, priority }) => {
31733
+ }, async ({ from: fromParam, message_id, content, priority }) => {
31730
31734
  const original = getMessageById(message_id);
31731
31735
  if (!original) {
31732
31736
  return {
@@ -31734,7 +31738,7 @@ var init_mcp2 = __esm(() => {
31734
31738
  isError: true
31735
31739
  };
31736
31740
  }
31737
- const from = resolveIdentity();
31741
+ const from = resolveIdentity(fromParam);
31738
31742
  const space = original.space || (original.session_id?.startsWith("space:") ? original.session_id.slice(6) : undefined);
31739
31743
  const to = space ? space : original.from_agent === from ? original.to_agent : original.from_agent;
31740
31744
  const msg = sendMessage({
@@ -31753,11 +31757,12 @@ var init_mcp2 = __esm(() => {
31753
31757
  title: "Mark Read",
31754
31758
  description: "Mark message IDs as read for the current agent. Set 'all' to true to mark all unread messages as read.",
31755
31759
  inputSchema: {
31760
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
31756
31761
  ids: exports_external.array(exports_external.number()).optional().describe("Message IDs to mark as read"),
31757
31762
  all: exports_external.boolean().optional().describe("Mark all unread messages as read")
31758
31763
  }
31759
- }, async ({ ids, all }) => {
31760
- const agent = resolveIdentity();
31764
+ }, async ({ from: fromParam, ids, all }) => {
31765
+ const agent = resolveIdentity(fromParam);
31761
31766
  let count;
31762
31767
  if (all) {
31763
31768
  count = markAllRead(agent);
@@ -31810,13 +31815,14 @@ var init_mcp2 = __esm(() => {
31810
31815
  title: "Create Space",
31811
31816
  description: "Create a new space. The creator is auto-joined. Spaces can be nested (max 3 levels) and associated with a project.",
31812
31817
  inputSchema: {
31818
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
31813
31819
  name: exports_external.string().describe("Space name (e.g. 'deployments', 'code-review')"),
31814
31820
  description: exports_external.string().optional().describe("Space description"),
31815
31821
  parent_id: exports_external.string().optional().describe("Parent space name for nesting (max 3 levels deep)"),
31816
31822
  project_id: exports_external.string().optional().describe("Project ID to associate this space with")
31817
31823
  }
31818
- }, async ({ name, description, parent_id, project_id }) => {
31819
- const agent = resolveIdentity();
31824
+ }, async ({ from: fromParam, name, description, parent_id, project_id }) => {
31825
+ const agent = resolveIdentity(fromParam);
31820
31826
  try {
31821
31827
  const sp = createSpace(name, agent, { description, parent_id, project_id });
31822
31828
  return {
@@ -31863,12 +31869,13 @@ var init_mcp2 = __esm(() => {
31863
31869
  title: "Send to Space",
31864
31870
  description: "Send a message to a space. All members can see it.",
31865
31871
  inputSchema: {
31872
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
31866
31873
  space: exports_external.string().describe("Space name"),
31867
31874
  content: exports_external.string().describe("Message content"),
31868
31875
  priority: exports_external.enum(["low", "normal", "high", "urgent"]).optional().describe("Message priority")
31869
31876
  }
31870
- }, async ({ space, content, priority }) => {
31871
- const from = resolveIdentity();
31877
+ }, async ({ from: fromParam, space, content, priority }) => {
31878
+ const from = resolveIdentity(fromParam);
31872
31879
  const sp = getSpace(space);
31873
31880
  if (!sp) {
31874
31881
  return {
@@ -31906,10 +31913,11 @@ var init_mcp2 = __esm(() => {
31906
31913
  title: "Join Space",
31907
31914
  description: "Join a space to receive messages.",
31908
31915
  inputSchema: {
31916
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
31909
31917
  space: exports_external.string().describe("Space name to join")
31910
31918
  }
31911
- }, async ({ space }) => {
31912
- const agent = resolveIdentity();
31919
+ }, async ({ from: fromParam, space }) => {
31920
+ const agent = resolveIdentity(fromParam);
31913
31921
  const ok = joinSpace(space, agent);
31914
31922
  if (!ok) {
31915
31923
  return {
@@ -31925,10 +31933,11 @@ var init_mcp2 = __esm(() => {
31925
31933
  title: "Leave Space",
31926
31934
  description: "Leave a space.",
31927
31935
  inputSchema: {
31936
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
31928
31937
  space: exports_external.string().describe("Space name to leave")
31929
31938
  }
31930
- }, async ({ space }) => {
31931
- const agent = resolveIdentity();
31939
+ }, async ({ from: fromParam, space }) => {
31940
+ const agent = resolveIdentity(fromParam);
31932
31941
  const left = leaveSpace(space, agent);
31933
31942
  return {
31934
31943
  content: [{ type: "text", text: JSON.stringify({ space, agent, left }, null, 2) }]
@@ -32005,6 +32014,7 @@ var init_mcp2 = __esm(() => {
32005
32014
  title: "Create Project",
32006
32015
  description: "Create a new project. Projects organize spaces and provide context for agent collaboration.",
32007
32016
  inputSchema: {
32017
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
32008
32018
  name: exports_external.string().describe("Project name (unique)"),
32009
32019
  description: exports_external.string().optional().describe("Project description"),
32010
32020
  path: exports_external.string().optional().describe("Absolute path to project on disk"),
@@ -32013,8 +32023,8 @@ var init_mcp2 = __esm(() => {
32013
32023
  metadata: exports_external.string().optional().describe("JSON metadata string"),
32014
32024
  settings: exports_external.string().optional().describe("JSON settings string")
32015
32025
  }
32016
- }, async ({ name, description, path, repository, tags, metadata, settings }) => {
32017
- const agent = resolveIdentity();
32026
+ }, async ({ from: fromParam, name, description, path, repository, tags, metadata, settings }) => {
32027
+ const agent = resolveIdentity(fromParam);
32018
32028
  let parsedTags;
32019
32029
  if (tags) {
32020
32030
  try {
@@ -32203,12 +32213,13 @@ var init_mcp2 = __esm(() => {
32203
32213
  });
32204
32214
  server.registerTool("delete_message", {
32205
32215
  title: "Delete Message",
32206
- description: "Delete a message. Only the sender can delete their own messages. The agent is auto-resolved.",
32216
+ description: "Delete a message. Only the sender can delete their own messages.",
32207
32217
  inputSchema: {
32218
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
32208
32219
  id: exports_external.number().describe("Message ID to delete")
32209
32220
  }
32210
- }, async ({ id }) => {
32211
- const agent = resolveIdentity();
32221
+ }, async ({ from: fromParam, id }) => {
32222
+ const agent = resolveIdentity(fromParam);
32212
32223
  const deleted = deleteMessage(id, agent);
32213
32224
  if (!deleted) {
32214
32225
  return {
@@ -32222,13 +32233,14 @@ var init_mcp2 = __esm(() => {
32222
32233
  });
32223
32234
  server.registerTool("edit_message", {
32224
32235
  title: "Edit Message",
32225
- description: "Edit a message's content. Only the sender can edit their own messages. The agent is auto-resolved.",
32236
+ description: "Edit a message's content. Only the sender can edit their own messages.",
32226
32237
  inputSchema: {
32238
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
32227
32239
  id: exports_external.number().describe("Message ID to edit"),
32228
32240
  content: exports_external.string().describe("New message content")
32229
32241
  }
32230
- }, async ({ id, content }) => {
32231
- const agent = resolveIdentity();
32242
+ }, async ({ from: fromParam, id, content }) => {
32243
+ const agent = resolveIdentity(fromParam);
32232
32244
  const msg = editMessage(id, agent, content);
32233
32245
  if (!msg) {
32234
32246
  return {
@@ -32292,12 +32304,13 @@ var init_mcp2 = __esm(() => {
32292
32304
  });
32293
32305
  server.registerTool("heartbeat", {
32294
32306
  title: "Heartbeat",
32295
- description: "Send a heartbeat to indicate agent is alive. Auto-resolves agent from CONVERSATIONS_AGENT_ID env var. Optionally set a status.",
32307
+ description: "Send a heartbeat to indicate agent is alive. Optionally set a status.",
32296
32308
  inputSchema: {
32309
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
32297
32310
  status: exports_external.string().optional().describe("Agent status (e.g. 'online', 'busy', 'idle'). Defaults to 'online'.")
32298
32311
  }
32299
- }, async ({ status }) => {
32300
- const agent = resolveIdentity();
32312
+ }, async ({ from: fromParam, status }) => {
32313
+ const agent = resolveIdentity(fromParam);
32301
32314
  heartbeat(agent, status);
32302
32315
  return {
32303
32316
  content: [{ type: "text", text: JSON.stringify({ agent, status: status || "online", heartbeat: true }, null, 2) }]
@@ -32731,8 +32744,8 @@ function startDashboardServer(port = 3456, host) {
32731
32744
  }
32732
32745
  if (path === "/api/version" && req.method === "GET") {
32733
32746
  try {
32734
- const pkg = await Promise.resolve().then(() => __toESM(require_package(), 1));
32735
- const current = pkg.version;
32747
+ const pkg2 = await Promise.resolve().then(() => __toESM(require_package(), 1));
32748
+ const current = pkg2.version;
32736
32749
  const res = await fetch("https://registry.npmjs.org/@hasna/conversations/latest");
32737
32750
  const data = await res.json();
32738
32751
  const latest = data.version;
@@ -32746,8 +32759,8 @@ function startDashboardServer(port = 3456, host) {
32746
32759
  return jsonResponse({ error: "Invalid origin" }, 403);
32747
32760
  }
32748
32761
  try {
32749
- const pkg = await Promise.resolve().then(() => __toESM(require_package(), 1));
32750
- const current = pkg.version;
32762
+ const pkg2 = await Promise.resolve().then(() => __toESM(require_package(), 1));
32763
+ const current = pkg2.version;
32751
32764
  const res = await fetch("https://registry.npmjs.org/@hasna/conversations/latest");
32752
32765
  const data = await res.json();
32753
32766
  const latest = data.version;
@@ -33830,8 +33843,9 @@ function App({ agent }) {
33830
33843
  }
33831
33844
 
33832
33845
  // src/cli/index.tsx
33846
+ var import__package2 = __toESM(require_package(), 1);
33833
33847
  var program2 = new Command;
33834
- program2.name("conversations").description("Real-time CLI messaging for AI agents").version("0.1.0");
33848
+ program2.name("conversations").description("Real-time CLI messaging for AI agents").version(import__package2.default.version);
33835
33849
  program2.command("send").description("Send a message to an agent").argument("<message>", "Message content").requiredOption("--to <agent>", "Recipient agent ID").option("--from <agent>", "Sender agent ID").option("--session <id>", "Session ID (auto-generated if omitted)").option("--priority <level>", "Priority: low, normal, high, urgent", "normal").option("--working-dir <path>", "Working directory context").option("--repository <repo>", "Repository context").option("--branch <branch>", "Branch context").option("--metadata <json>", "JSON metadata string").option("--json", "Output as JSON").action((message, opts) => {
33836
33850
  const from = resolveIdentity(opts.from).trim();
33837
33851
  const to = typeof opts.to === "string" ? opts.to.trim() : "";
@@ -34064,8 +34078,8 @@ program2.command("status").description("Show database stats").option("--json", "
34064
34078
  closeDb();
34065
34079
  });
34066
34080
  program2.command("update").description("Check for and install updates").option("--check", "Only check for updates, don't install").option("--json", "Output as JSON").action(async (opts) => {
34067
- const pkg = await Promise.resolve().then(() => __toESM(require_package(), 1));
34068
- const current = pkg.version;
34081
+ const pkg3 = await Promise.resolve().then(() => __toESM(require_package(), 1));
34082
+ const current = pkg3.version;
34069
34083
  let latest;
34070
34084
  try {
34071
34085
  const res = await fetch("https://registry.npmjs.org/@hasna/conversations/latest");
package/bin/mcp.js CHANGED
@@ -29090,16 +29090,91 @@ function listAgents(opts) {
29090
29090
  const rows = db2.prepare(query).all(...params);
29091
29091
  return rows.map(parsePresence);
29092
29092
  }
29093
+ // package.json
29094
+ var package_default = {
29095
+ name: "@hasna/conversations",
29096
+ version: "0.1.3",
29097
+ description: "Real-time CLI messaging for AI agents",
29098
+ type: "module",
29099
+ bin: {
29100
+ conversations: "bin/index.js",
29101
+ "conversations-mcp": "bin/mcp.js"
29102
+ },
29103
+ exports: {
29104
+ ".": {
29105
+ import: "./dist/index.js",
29106
+ types: "./dist/index.d.ts"
29107
+ }
29108
+ },
29109
+ files: [
29110
+ "dist/",
29111
+ "bin/",
29112
+ "dashboard/dist/",
29113
+ "LICENSE",
29114
+ "README.md"
29115
+ ],
29116
+ main: "./dist/index.js",
29117
+ types: "./dist/index.d.ts",
29118
+ scripts: {
29119
+ build: "bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
29120
+ "build:dashboard": "cd dashboard && bun install && bun run build",
29121
+ test: "bun test",
29122
+ dev: "bun run ./src/cli/index.tsx",
29123
+ typecheck: "tsc --noEmit",
29124
+ prepublishOnly: "bun run build"
29125
+ },
29126
+ keywords: [
29127
+ "conversations",
29128
+ "messaging",
29129
+ "ai",
29130
+ "agent",
29131
+ "cli",
29132
+ "typescript",
29133
+ "bun",
29134
+ "claude",
29135
+ "mcp"
29136
+ ],
29137
+ author: "Hasna",
29138
+ license: "Apache-2.0",
29139
+ devDependencies: {
29140
+ "@types/bun": "latest",
29141
+ "@types/react": "^18.2.0",
29142
+ typescript: "^5"
29143
+ },
29144
+ dependencies: {
29145
+ "@modelcontextprotocol/sdk": "^1.26.0",
29146
+ chalk: "^5.3.0",
29147
+ commander: "^12.1.0",
29148
+ ink: "^5.0.1",
29149
+ "ink-select-input": "^6.0.0",
29150
+ "ink-spinner": "^5.0.0",
29151
+ "ink-text-input": "^6.0.0",
29152
+ react: "^18.2.0",
29153
+ zod: "^4.3.6"
29154
+ },
29155
+ engines: {
29156
+ bun: ">=1.0.0"
29157
+ },
29158
+ publishConfig: {
29159
+ registry: "https://registry.npmjs.org",
29160
+ access: "public"
29161
+ },
29162
+ repository: {
29163
+ type: "git",
29164
+ url: "git+https://github.com/hasna/conversations.git"
29165
+ }
29166
+ };
29093
29167
 
29094
29168
  // src/mcp/index.ts
29095
29169
  var server = new McpServer({
29096
29170
  name: "conversations",
29097
- version: "0.1.0"
29171
+ version: package_default.version
29098
29172
  });
29099
29173
  server.registerTool("send_message", {
29100
29174
  title: "Send Message",
29101
- description: "Send a direct message to another agent. The sender is auto-resolved from CONVERSATIONS_AGENT_ID env var.",
29175
+ description: "Send a direct message to another agent. Pass 'from' to identify yourself, or it falls back to CONVERSATIONS_AGENT_ID env var.",
29102
29176
  inputSchema: {
29177
+ from: exports_external.string().optional().describe("Your agent ID (e.g. 'claude-1', 'assistant'). Falls back to CONVERSATIONS_AGENT_ID env var."),
29103
29178
  to: exports_external.string().describe("Recipient agent ID"),
29104
29179
  content: exports_external.string().describe("Message content"),
29105
29180
  session_id: exports_external.string().optional().describe("Session ID (auto-generated if omitted)"),
@@ -29109,8 +29184,8 @@ server.registerTool("send_message", {
29109
29184
  branch: exports_external.string().optional().describe("Branch context"),
29110
29185
  metadata: exports_external.string().optional().describe("JSON metadata string")
29111
29186
  }
29112
- }, async ({ to, content, session_id, priority, working_dir, repository, branch, metadata }) => {
29113
- const from = resolveIdentity();
29187
+ }, async ({ from: fromParam, to, content, session_id, priority, working_dir, repository, branch, metadata }) => {
29188
+ const from = resolveIdentity(fromParam);
29114
29189
  let parsedMetadata;
29115
29190
  if (metadata) {
29116
29191
  try {
@@ -29171,11 +29246,12 @@ server.registerTool("reply", {
29171
29246
  title: "Reply to Message",
29172
29247
  description: "Reply to a message by its ID. Automatically uses the same session and sends to the original sender.",
29173
29248
  inputSchema: {
29249
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29174
29250
  message_id: exports_external.number().describe("ID of the message to reply to"),
29175
29251
  content: exports_external.string().describe("Reply content"),
29176
29252
  priority: exports_external.enum(["low", "normal", "high", "urgent"]).optional().describe("Message priority")
29177
29253
  }
29178
- }, async ({ message_id, content, priority }) => {
29254
+ }, async ({ from: fromParam, message_id, content, priority }) => {
29179
29255
  const original = getMessageById(message_id);
29180
29256
  if (!original) {
29181
29257
  return {
@@ -29183,7 +29259,7 @@ server.registerTool("reply", {
29183
29259
  isError: true
29184
29260
  };
29185
29261
  }
29186
- const from = resolveIdentity();
29262
+ const from = resolveIdentity(fromParam);
29187
29263
  const space = original.space || (original.session_id?.startsWith("space:") ? original.session_id.slice(6) : undefined);
29188
29264
  const to = space ? space : original.from_agent === from ? original.to_agent : original.from_agent;
29189
29265
  const msg = sendMessage({
@@ -29202,11 +29278,12 @@ server.registerTool("mark_read", {
29202
29278
  title: "Mark Read",
29203
29279
  description: "Mark message IDs as read for the current agent. Set 'all' to true to mark all unread messages as read.",
29204
29280
  inputSchema: {
29281
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29205
29282
  ids: exports_external.array(exports_external.number()).optional().describe("Message IDs to mark as read"),
29206
29283
  all: exports_external.boolean().optional().describe("Mark all unread messages as read")
29207
29284
  }
29208
- }, async ({ ids, all }) => {
29209
- const agent = resolveIdentity();
29285
+ }, async ({ from: fromParam, ids, all }) => {
29286
+ const agent = resolveIdentity(fromParam);
29210
29287
  let count;
29211
29288
  if (all) {
29212
29289
  count = markAllRead(agent);
@@ -29259,13 +29336,14 @@ server.registerTool("create_space", {
29259
29336
  title: "Create Space",
29260
29337
  description: "Create a new space. The creator is auto-joined. Spaces can be nested (max 3 levels) and associated with a project.",
29261
29338
  inputSchema: {
29339
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29262
29340
  name: exports_external.string().describe("Space name (e.g. 'deployments', 'code-review')"),
29263
29341
  description: exports_external.string().optional().describe("Space description"),
29264
29342
  parent_id: exports_external.string().optional().describe("Parent space name for nesting (max 3 levels deep)"),
29265
29343
  project_id: exports_external.string().optional().describe("Project ID to associate this space with")
29266
29344
  }
29267
- }, async ({ name, description, parent_id, project_id }) => {
29268
- const agent = resolveIdentity();
29345
+ }, async ({ from: fromParam, name, description, parent_id, project_id }) => {
29346
+ const agent = resolveIdentity(fromParam);
29269
29347
  try {
29270
29348
  const sp = createSpace(name, agent, { description, parent_id, project_id });
29271
29349
  return {
@@ -29312,12 +29390,13 @@ server.registerTool("send_to_space", {
29312
29390
  title: "Send to Space",
29313
29391
  description: "Send a message to a space. All members can see it.",
29314
29392
  inputSchema: {
29393
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29315
29394
  space: exports_external.string().describe("Space name"),
29316
29395
  content: exports_external.string().describe("Message content"),
29317
29396
  priority: exports_external.enum(["low", "normal", "high", "urgent"]).optional().describe("Message priority")
29318
29397
  }
29319
- }, async ({ space, content, priority }) => {
29320
- const from = resolveIdentity();
29398
+ }, async ({ from: fromParam, space, content, priority }) => {
29399
+ const from = resolveIdentity(fromParam);
29321
29400
  const sp = getSpace(space);
29322
29401
  if (!sp) {
29323
29402
  return {
@@ -29355,10 +29434,11 @@ server.registerTool("join_space", {
29355
29434
  title: "Join Space",
29356
29435
  description: "Join a space to receive messages.",
29357
29436
  inputSchema: {
29437
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29358
29438
  space: exports_external.string().describe("Space name to join")
29359
29439
  }
29360
- }, async ({ space }) => {
29361
- const agent = resolveIdentity();
29440
+ }, async ({ from: fromParam, space }) => {
29441
+ const agent = resolveIdentity(fromParam);
29362
29442
  const ok = joinSpace(space, agent);
29363
29443
  if (!ok) {
29364
29444
  return {
@@ -29374,10 +29454,11 @@ server.registerTool("leave_space", {
29374
29454
  title: "Leave Space",
29375
29455
  description: "Leave a space.",
29376
29456
  inputSchema: {
29457
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29377
29458
  space: exports_external.string().describe("Space name to leave")
29378
29459
  }
29379
- }, async ({ space }) => {
29380
- const agent = resolveIdentity();
29460
+ }, async ({ from: fromParam, space }) => {
29461
+ const agent = resolveIdentity(fromParam);
29381
29462
  const left = leaveSpace(space, agent);
29382
29463
  return {
29383
29464
  content: [{ type: "text", text: JSON.stringify({ space, agent, left }, null, 2) }]
@@ -29454,6 +29535,7 @@ server.registerTool("create_project", {
29454
29535
  title: "Create Project",
29455
29536
  description: "Create a new project. Projects organize spaces and provide context for agent collaboration.",
29456
29537
  inputSchema: {
29538
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29457
29539
  name: exports_external.string().describe("Project name (unique)"),
29458
29540
  description: exports_external.string().optional().describe("Project description"),
29459
29541
  path: exports_external.string().optional().describe("Absolute path to project on disk"),
@@ -29462,8 +29544,8 @@ server.registerTool("create_project", {
29462
29544
  metadata: exports_external.string().optional().describe("JSON metadata string"),
29463
29545
  settings: exports_external.string().optional().describe("JSON settings string")
29464
29546
  }
29465
- }, async ({ name, description, path, repository, tags, metadata, settings }) => {
29466
- const agent = resolveIdentity();
29547
+ }, async ({ from: fromParam, name, description, path, repository, tags, metadata, settings }) => {
29548
+ const agent = resolveIdentity(fromParam);
29467
29549
  let parsedTags;
29468
29550
  if (tags) {
29469
29551
  try {
@@ -29652,12 +29734,13 @@ server.registerTool("delete_project", {
29652
29734
  });
29653
29735
  server.registerTool("delete_message", {
29654
29736
  title: "Delete Message",
29655
- description: "Delete a message. Only the sender can delete their own messages. The agent is auto-resolved.",
29737
+ description: "Delete a message. Only the sender can delete their own messages.",
29656
29738
  inputSchema: {
29739
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29657
29740
  id: exports_external.number().describe("Message ID to delete")
29658
29741
  }
29659
- }, async ({ id }) => {
29660
- const agent = resolveIdentity();
29742
+ }, async ({ from: fromParam, id }) => {
29743
+ const agent = resolveIdentity(fromParam);
29661
29744
  const deleted = deleteMessage(id, agent);
29662
29745
  if (!deleted) {
29663
29746
  return {
@@ -29671,13 +29754,14 @@ server.registerTool("delete_message", {
29671
29754
  });
29672
29755
  server.registerTool("edit_message", {
29673
29756
  title: "Edit Message",
29674
- description: "Edit a message's content. Only the sender can edit their own messages. The agent is auto-resolved.",
29757
+ description: "Edit a message's content. Only the sender can edit their own messages.",
29675
29758
  inputSchema: {
29759
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29676
29760
  id: exports_external.number().describe("Message ID to edit"),
29677
29761
  content: exports_external.string().describe("New message content")
29678
29762
  }
29679
- }, async ({ id, content }) => {
29680
- const agent = resolveIdentity();
29763
+ }, async ({ from: fromParam, id, content }) => {
29764
+ const agent = resolveIdentity(fromParam);
29681
29765
  const msg = editMessage(id, agent, content);
29682
29766
  if (!msg) {
29683
29767
  return {
@@ -29741,12 +29825,13 @@ server.registerTool("get_pinned_messages", {
29741
29825
  });
29742
29826
  server.registerTool("heartbeat", {
29743
29827
  title: "Heartbeat",
29744
- description: "Send a heartbeat to indicate agent is alive. Auto-resolves agent from CONVERSATIONS_AGENT_ID env var. Optionally set a status.",
29828
+ description: "Send a heartbeat to indicate agent is alive. Optionally set a status.",
29745
29829
  inputSchema: {
29830
+ from: exports_external.string().optional().describe("Your agent ID. Falls back to CONVERSATIONS_AGENT_ID env var."),
29746
29831
  status: exports_external.string().optional().describe("Agent status (e.g. 'online', 'busy', 'idle'). Defaults to 'online'.")
29747
29832
  }
29748
- }, async ({ status }) => {
29749
- const agent = resolveIdentity();
29833
+ }, async ({ from: fromParam, status }) => {
29834
+ const agent = resolveIdentity(fromParam);
29750
29835
  heartbeat(agent, status);
29751
29836
  return {
29752
29837
  content: [{ type: "text", text: JSON.stringify({ agent, status: status || "online", heartbeat: true }, null, 2) }]
@@ -29776,5 +29861,6 @@ if (isDirectRun) {
29776
29861
  });
29777
29862
  }
29778
29863
  export {
29779
- startMcpServer
29864
+ startMcpServer,
29865
+ server
29780
29866
  };
@@ -7,4 +7,6 @@
7
7
  * conversations mcp # Start MCP server on stdio
8
8
  * conversations-mcp # Direct binary
9
9
  */
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
+ export declare const server: McpServer;
10
12
  export declare function startMcpServer(): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {