@hasna/conversations 0.2.49 → 0.2.51

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/README.md CHANGED
@@ -35,13 +35,13 @@ conversations-mcp
35
35
  Long-lived Streamable HTTP transport (stateless, bind `127.0.0.1` only):
36
36
 
37
37
  ```bash
38
- conversations-mcp --http # default port 8811
39
- conversations-mcp --http --port 8811
38
+ conversations-mcp --http # default port 8856
39
+ conversations-mcp --http --port 8856
40
40
  MCP_HTTP=1 conversations-mcp
41
41
  ```
42
42
 
43
- - Health: `GET http://127.0.0.1:8811/health`
44
- - MCP: `http://127.0.0.1:8811/mcp`
43
+ - Health: `GET http://127.0.0.1:8856/health`
44
+ - MCP: `http://127.0.0.1:8856/mcp`
45
45
 
46
46
  The dashboard server also exposes `/health` and `/mcp` when running.
47
47
 
package/bin/hook.js CHANGED
@@ -4,37 +4,27 @@ var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- function __accessProp(key) {
8
- return this[key];
9
- }
7
+ var __moduleCache = /* @__PURE__ */ new WeakMap;
10
8
  var __toCommonJS = (from) => {
11
- var entry = (__moduleCache ??= new WeakMap).get(from), desc;
9
+ var entry = __moduleCache.get(from), desc;
12
10
  if (entry)
13
11
  return entry;
14
12
  entry = __defProp({}, "__esModule", { value: true });
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (var key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(entry, key))
18
- __defProp(entry, key, {
19
- get: __accessProp.bind(from, key),
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
22
- }
13
+ if (from && typeof from === "object" || typeof from === "function")
14
+ __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ }));
23
18
  __moduleCache.set(from, entry);
24
19
  return entry;
25
20
  };
26
- var __moduleCache;
27
- var __returnValue = (v) => v;
28
- function __exportSetter(name, newValue) {
29
- this[name] = __returnValue.bind(null, newValue);
30
- }
31
21
  var __export = (target, all) => {
32
22
  for (var name in all)
33
23
  __defProp(target, name, {
34
24
  get: all[name],
35
25
  enumerable: true,
36
26
  configurable: true,
37
- set: __exportSetter.bind(all, name)
27
+ set: (newValue) => all[name] = () => newValue
38
28
  });
39
29
  };
40
30
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -60,11 +50,11 @@ import { homedir as homedir4 } from "os";
60
50
  import { join as join4 } from "path";
61
51
  import { join as join6, dirname } from "path";
62
52
  import { homedir as homedir5, platform } from "os";
63
- function __accessProp2(key) {
53
+ function __accessProp(key) {
64
54
  return this[key];
65
55
  }
66
- function __exportSetter2(name, newValue) {
67
- this[name] = __returnValue2.bind(null, newValue);
56
+ function __exportSetter(name, newValue) {
57
+ this[name] = __returnValue.bind(null, newValue);
68
58
  }
69
59
  function translateSql(sql, dialect) {
70
60
  if (dialect === "sqlite")
@@ -1107,19 +1097,19 @@ var __create, __getProtoOf, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toE
1107
1097
  for (let key of __getOwnPropNames2(mod))
1108
1098
  if (!__hasOwnProp2.call(to, key))
1109
1099
  __defProp2(to, key, {
1110
- get: __accessProp2.bind(mod, key),
1100
+ get: __accessProp.bind(mod, key),
1111
1101
  enumerable: true
1112
1102
  });
1113
1103
  if (canCache)
1114
1104
  cache.set(mod, to);
1115
1105
  return to;
1116
- }, __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue2 = (v) => v, __export2 = (target, all) => {
1106
+ }, __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue = (v) => v, __export2 = (target, all) => {
1117
1107
  for (var name in all)
1118
1108
  __defProp2(target, name, {
1119
1109
  get: all[name],
1120
1110
  enumerable: true,
1121
1111
  configurable: true,
1122
- set: __exportSetter2.bind(all, name)
1112
+ set: __exportSetter.bind(all, name)
1123
1113
  });
1124
1114
  }, __esm2 = (fn, res) => () => (fn && (res = fn(fn = 0)), res), __require, require_postgres_array, require_arrayParser, require_postgres_date, require_mutable, require_postgres_interval, require_postgres_bytea, require_textParsers, require_pg_int8, require_binaryParsers, require_builtins, require_pg_types, require_defaults, require_utils, require_utils_legacy, require_utils_webcrypto, require_utils2, require_cert_signatures, require_sasl, require_type_overrides, require_pg_connection_string, require_connection_parameters, require_result, require_query, require_messages, require_buffer_writer, require_serializer, require_buffer_reader, require_parser, require_dist, require_empty, require_stream, require_connection, require_split2, require_helper, require_lib, require_client, require_pg_pool, require_query2, require_client2, require_lib2, import_lib, Client, Pool, Connection, types, Query, DatabaseError, escapeIdentifier, escapeLiteral, Result, TypeOverrides, defaults, esm_default, init_esm, init_adapter, util, objectUtil, ZodParsedType, getParsedType = (data) => {
1125
1115
  const t = typeof data;
@@ -9614,6 +9604,17 @@ function getDb() {
9614
9604
  read_at TEXT
9615
9605
  )
9616
9606
  `);
9607
+ const initialMsgCols = db.prepare("PRAGMA table_info(messages)").all();
9608
+ const initialMsgColNames = initialMsgCols.map((c) => c.name);
9609
+ if (initialMsgColNames.includes("channel") && !initialMsgColNames.includes("space")) {
9610
+ db.exec("ALTER TABLE messages ADD COLUMN space TEXT");
9611
+ db.exec("UPDATE messages SET space = channel WHERE channel IS NOT NULL");
9612
+ db.exec(`
9613
+ UPDATE messages
9614
+ SET session_id = 'space:' || substr(session_id, 9)
9615
+ WHERE session_id LIKE 'channel:%'
9616
+ `);
9617
+ }
9617
9618
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_session ON messages(session_id)");
9618
9619
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
9619
9620
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
package/bin/index.js CHANGED
@@ -6,60 +6,39 @@ var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- function __accessProp(key) {
10
- return this[key];
11
- }
12
- var __toESMCache_node;
13
- var __toESMCache_esm;
14
9
  var __toESM = (mod, isNodeMode, target) => {
15
- var canCache = mod != null && typeof mod === "object";
16
- if (canCache) {
17
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
18
- var cached = cache.get(mod);
19
- if (cached)
20
- return cached;
21
- }
22
10
  target = mod != null ? __create(__getProtoOf(mod)) : {};
23
11
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
24
12
  for (let key of __getOwnPropNames(mod))
25
13
  if (!__hasOwnProp.call(to, key))
26
14
  __defProp(to, key, {
27
- get: __accessProp.bind(mod, key),
15
+ get: () => mod[key],
28
16
  enumerable: true
29
17
  });
30
- if (canCache)
31
- cache.set(mod, to);
32
18
  return to;
33
19
  };
20
+ var __moduleCache = /* @__PURE__ */ new WeakMap;
34
21
  var __toCommonJS = (from) => {
35
- var entry = (__moduleCache ??= new WeakMap).get(from), desc;
22
+ var entry = __moduleCache.get(from), desc;
36
23
  if (entry)
37
24
  return entry;
38
25
  entry = __defProp({}, "__esModule", { value: true });
39
- if (from && typeof from === "object" || typeof from === "function") {
40
- for (var key of __getOwnPropNames(from))
41
- if (!__hasOwnProp.call(entry, key))
42
- __defProp(entry, key, {
43
- get: __accessProp.bind(from, key),
44
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
45
- });
46
- }
26
+ if (from && typeof from === "object" || typeof from === "function")
27
+ __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
28
+ get: () => from[key],
29
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
+ }));
47
31
  __moduleCache.set(from, entry);
48
32
  return entry;
49
33
  };
50
- var __moduleCache;
51
34
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
52
- var __returnValue = (v) => v;
53
- function __exportSetter(name, newValue) {
54
- this[name] = __returnValue.bind(null, newValue);
55
- }
56
35
  var __export = (target, all) => {
57
36
  for (var name in all)
58
37
  __defProp(target, name, {
59
38
  get: all[name],
60
39
  enumerable: true,
61
40
  configurable: true,
62
- set: __exportSetter.bind(all, name)
41
+ set: (newValue) => all[name] = () => newValue
63
42
  });
64
43
  };
65
44
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -2351,11 +2330,11 @@ import { join as join5 } from "path";
2351
2330
  import { join as join6, dirname } from "path";
2352
2331
  import { existsSync as existsSync6, writeFileSync as writeFileSync2, unlinkSync, mkdirSync as mkdirSync3 } from "fs";
2353
2332
  import { homedir as homedir5, platform } from "os";
2354
- function __accessProp2(key) {
2333
+ function __accessProp(key) {
2355
2334
  return this[key];
2356
2335
  }
2357
- function __exportSetter2(name, newValue) {
2358
- this[name] = __returnValue2.bind(null, newValue);
2336
+ function __exportSetter(name, newValue) {
2337
+ this[name] = __returnValue.bind(null, newValue);
2359
2338
  }
2360
2339
  function translateSql(sql, dialect) {
2361
2340
  if (dialect === "sqlite")
@@ -4996,10 +4975,10 @@ function registerCloudCommands(program2, serviceName) {
4996
4975
  }
4997
4976
  });
4998
4977
  }
4999
- var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node2, __toESMCache_esm2, __toESM2 = (mod, isNodeMode, target) => {
4978
+ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node, __toESMCache_esm, __toESM2 = (mod, isNodeMode, target) => {
5000
4979
  var canCache = mod != null && typeof mod === "object";
5001
4980
  if (canCache) {
5002
- var cache = isNodeMode ? __toESMCache_node2 ??= new WeakMap : __toESMCache_esm2 ??= new WeakMap;
4981
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
5003
4982
  var cached = cache.get(mod);
5004
4983
  if (cached)
5005
4984
  return cached;
@@ -5009,19 +4988,19 @@ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __t
5009
4988
  for (let key of __getOwnPropNames2(mod))
5010
4989
  if (!__hasOwnProp2.call(to, key))
5011
4990
  __defProp2(to, key, {
5012
- get: __accessProp2.bind(mod, key),
4991
+ get: __accessProp.bind(mod, key),
5013
4992
  enumerable: true
5014
4993
  });
5015
4994
  if (canCache)
5016
4995
  cache.set(mod, to);
5017
4996
  return to;
5018
- }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue2 = (v) => v, __export2 = (target, all) => {
4997
+ }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue = (v) => v, __export2 = (target, all) => {
5019
4998
  for (var name in all)
5020
4999
  __defProp2(target, name, {
5021
5000
  get: all[name],
5022
5001
  enumerable: true,
5023
5002
  configurable: true,
5024
- set: __exportSetter2.bind(all, name)
5003
+ set: __exportSetter.bind(all, name)
5025
5004
  });
5026
5005
  }, __esm2 = (fn, res) => () => (fn && (res = fn(fn = 0)), res), __require2, require_postgres_array, require_arrayParser, require_postgres_date, require_mutable, require_postgres_interval, require_postgres_bytea, require_textParsers, require_pg_int8, require_binaryParsers, require_builtins, require_pg_types, require_defaults, require_utils, require_utils_legacy, require_utils_webcrypto, require_utils2, require_cert_signatures, require_sasl, require_type_overrides, require_pg_connection_string, require_connection_parameters, require_result, require_query, require_messages, require_buffer_writer, require_serializer, require_buffer_reader, require_parser, require_dist, require_empty, require_stream, require_connection, require_split2, require_helper, require_lib, require_client, require_pg_pool, require_query2, require_client2, require_lib2, import_lib, Client, Pool, Connection, types, Query, DatabaseError, escapeIdentifier, escapeLiteral, Result, TypeOverrides, defaults, esm_default, init_esm, init_adapter, util, objectUtil, ZodParsedType, getParsedType = (data) => {
5027
5006
  const t = typeof data;
@@ -13536,6 +13515,17 @@ function getDb() {
13536
13515
  read_at TEXT
13537
13516
  )
13538
13517
  `);
13518
+ const initialMsgCols = db.prepare("PRAGMA table_info(messages)").all();
13519
+ const initialMsgColNames = initialMsgCols.map((c) => c.name);
13520
+ if (initialMsgColNames.includes("channel") && !initialMsgColNames.includes("space")) {
13521
+ db.exec("ALTER TABLE messages ADD COLUMN space TEXT");
13522
+ db.exec("UPDATE messages SET space = channel WHERE channel IS NOT NULL");
13523
+ db.exec(`
13524
+ UPDATE messages
13525
+ SET session_id = 'space:' || substr(session_id, 9)
13526
+ WHERE session_id LIKE 'channel:%'
13527
+ `);
13528
+ }
13539
13529
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_session ON messages(session_id)");
13540
13530
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
13541
13531
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
@@ -15538,7 +15528,7 @@ var init_space_notifications = __esm(() => {
15538
15528
  var require_package = __commonJS((exports, module) => {
15539
15529
  module.exports = {
15540
15530
  name: "@hasna/conversations",
15541
- version: "0.2.49",
15531
+ version: "0.2.51",
15542
15532
  description: "Real-time CLI messaging for AI agents",
15543
15533
  type: "module",
15544
15534
  bin: {
@@ -49657,8 +49647,8 @@ var init_webStandardStreamableHttp = __esm(() => {
49657
49647
  });
49658
49648
 
49659
49649
  // src/mcp/http.ts
49660
- function isHttpMode(args) {
49661
- return args.includes("--http") || process.env.MCP_HTTP === "1";
49650
+ function isStdioMode(args) {
49651
+ return args.includes("--stdio") || process.env.MCP_STDIO === "1";
49662
49652
  }
49663
49653
  function resolveMcpHttpPort(args) {
49664
49654
  const portIdx = args.indexOf("--port");
@@ -49700,7 +49690,7 @@ function startMcpHttpServer(options) {
49700
49690
  console.error(`${name}-mcp HTTP listening on http://${MCP_HTTP_HOST}:${port}/mcp`);
49701
49691
  return server;
49702
49692
  }
49703
- var DEFAULT_MCP_HTTP_PORT = 8811, MCP_HTTP_HOST = "127.0.0.1", MCP_SERVICE_NAME = "conversations";
49693
+ var DEFAULT_MCP_HTTP_PORT = 8856, MCP_HTTP_HOST = "127.0.0.1", MCP_SERVICE_NAME = "conversations";
49704
49694
  var init_http = __esm(() => {
49705
49695
  init_webStandardStreamableHttp();
49706
49696
  });
@@ -49754,12 +49744,12 @@ async function main() {
49754
49744
 
49755
49745
  Usage:
49756
49746
  conversations-mcp stdio transport (default)
49757
- conversations-mcp --http Streamable HTTP on 127.0.0.1:8811
49747
+ conversations-mcp --http Streamable HTTP on 127.0.0.1:8856
49758
49748
  conversations-mcp --http --port <n>
49759
49749
 
49760
49750
  Environment:
49761
49751
  MCP_HTTP=1 Enable HTTP mode
49762
- MCP_HTTP_PORT=<n> Override default port (8811)
49752
+ MCP_HTTP_PORT=<n> Override default port (8856)
49763
49753
  `);
49764
49754
  return;
49765
49755
  }
@@ -49767,15 +49757,15 @@ Environment:
49767
49757
  console.log(import__package2.default.version);
49768
49758
  return;
49769
49759
  }
49770
- if (isHttpMode(args)) {
49771
- startMcpHttpServer({
49772
- name: "conversations",
49773
- port: resolveMcpHttpPort(args),
49774
- buildServer: () => buildServer(true)
49775
- });
49760
+ if (isStdioMode(args)) {
49761
+ await startMcpServer();
49776
49762
  return;
49777
49763
  }
49778
- await startMcpServer();
49764
+ startMcpHttpServer({
49765
+ name: "conversations",
49766
+ port: resolveMcpHttpPort(args),
49767
+ buildServer: () => buildServer(true)
49768
+ });
49779
49769
  }
49780
49770
  var import__package2, agentFocus, server, isDirectRun;
49781
49771
  var init_mcp2 = __esm(() => {
package/bin/mcp.js CHANGED
@@ -6,60 +6,39 @@ var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- function __accessProp(key) {
10
- return this[key];
11
- }
12
- var __toESMCache_node;
13
- var __toESMCache_esm;
14
9
  var __toESM = (mod, isNodeMode, target) => {
15
- var canCache = mod != null && typeof mod === "object";
16
- if (canCache) {
17
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
18
- var cached = cache.get(mod);
19
- if (cached)
20
- return cached;
21
- }
22
10
  target = mod != null ? __create(__getProtoOf(mod)) : {};
23
11
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
24
12
  for (let key of __getOwnPropNames(mod))
25
13
  if (!__hasOwnProp.call(to, key))
26
14
  __defProp(to, key, {
27
- get: __accessProp.bind(mod, key),
15
+ get: () => mod[key],
28
16
  enumerable: true
29
17
  });
30
- if (canCache)
31
- cache.set(mod, to);
32
18
  return to;
33
19
  };
20
+ var __moduleCache = /* @__PURE__ */ new WeakMap;
34
21
  var __toCommonJS = (from) => {
35
- var entry = (__moduleCache ??= new WeakMap).get(from), desc;
22
+ var entry = __moduleCache.get(from), desc;
36
23
  if (entry)
37
24
  return entry;
38
25
  entry = __defProp({}, "__esModule", { value: true });
39
- if (from && typeof from === "object" || typeof from === "function") {
40
- for (var key of __getOwnPropNames(from))
41
- if (!__hasOwnProp.call(entry, key))
42
- __defProp(entry, key, {
43
- get: __accessProp.bind(from, key),
44
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
45
- });
46
- }
26
+ if (from && typeof from === "object" || typeof from === "function")
27
+ __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
28
+ get: () => from[key],
29
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
+ }));
47
31
  __moduleCache.set(from, entry);
48
32
  return entry;
49
33
  };
50
- var __moduleCache;
51
34
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
52
- var __returnValue = (v) => v;
53
- function __exportSetter(name, newValue) {
54
- this[name] = __returnValue.bind(null, newValue);
55
- }
56
35
  var __export = (target, all) => {
57
36
  for (var name in all)
58
37
  __defProp(target, name, {
59
38
  get: all[name],
60
39
  enumerable: true,
61
40
  configurable: true,
62
- set: __exportSetter.bind(all, name)
41
+ set: (newValue) => all[name] = () => newValue
63
42
  });
64
43
  };
65
44
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -6631,11 +6610,11 @@ import { join as join5 } from "path";
6631
6610
  import { join as join6, dirname } from "path";
6632
6611
  import { existsSync as existsSync6, writeFileSync as writeFileSync2, unlinkSync, mkdirSync as mkdirSync3 } from "fs";
6633
6612
  import { homedir as homedir5, platform } from "os";
6634
- function __accessProp2(key) {
6613
+ function __accessProp(key) {
6635
6614
  return this[key];
6636
6615
  }
6637
- function __exportSetter2(name, newValue) {
6638
- this[name] = __returnValue2.bind(null, newValue);
6616
+ function __exportSetter(name, newValue) {
6617
+ this[name] = __returnValue.bind(null, newValue);
6639
6618
  }
6640
6619
  function translateSql(sql, dialect) {
6641
6620
  if (dialect === "sqlite")
@@ -9276,10 +9255,10 @@ function registerCloudCommands(program, serviceName) {
9276
9255
  }
9277
9256
  });
9278
9257
  }
9279
- var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node2, __toESMCache_esm2, __toESM2 = (mod, isNodeMode, target) => {
9258
+ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node, __toESMCache_esm, __toESM2 = (mod, isNodeMode, target) => {
9280
9259
  var canCache = mod != null && typeof mod === "object";
9281
9260
  if (canCache) {
9282
- var cache = isNodeMode ? __toESMCache_node2 ??= new WeakMap : __toESMCache_esm2 ??= new WeakMap;
9261
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
9283
9262
  var cached2 = cache.get(mod);
9284
9263
  if (cached2)
9285
9264
  return cached2;
@@ -9289,19 +9268,19 @@ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __t
9289
9268
  for (let key of __getOwnPropNames2(mod))
9290
9269
  if (!__hasOwnProp2.call(to, key))
9291
9270
  __defProp2(to, key, {
9292
- get: __accessProp2.bind(mod, key),
9271
+ get: __accessProp.bind(mod, key),
9293
9272
  enumerable: true
9294
9273
  });
9295
9274
  if (canCache)
9296
9275
  cache.set(mod, to);
9297
9276
  return to;
9298
- }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue2 = (v) => v, __export2 = (target, all) => {
9277
+ }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue = (v) => v, __export2 = (target, all) => {
9299
9278
  for (var name in all)
9300
9279
  __defProp2(target, name, {
9301
9280
  get: all[name],
9302
9281
  enumerable: true,
9303
9282
  configurable: true,
9304
- set: __exportSetter2.bind(all, name)
9283
+ set: __exportSetter.bind(all, name)
9305
9284
  });
9306
9285
  }, __esm2 = (fn, res) => () => (fn && (res = fn(fn = 0)), res), __require, require_postgres_array, require_arrayParser, require_postgres_date, require_mutable, require_postgres_interval, require_postgres_bytea, require_textParsers, require_pg_int8, require_binaryParsers, require_builtins, require_pg_types, require_defaults2, require_utils2, require_utils_legacy, require_utils_webcrypto, require_utils22, require_cert_signatures, require_sasl, require_type_overrides, require_pg_connection_string, require_connection_parameters, require_result, require_query, require_messages, require_buffer_writer, require_serializer, require_buffer_reader, require_parser, require_dist2, require_empty, require_stream, require_connection, require_split2, require_helper, require_lib, require_client, require_pg_pool, require_query2, require_client2, require_lib2, import_lib, Client, Pool, Connection, types, Query, DatabaseError, escapeIdentifier, escapeLiteral, Result, TypeOverrides, defaults, esm_default, init_esm, init_adapter, util2, objectUtil2, ZodParsedType2, getParsedType3 = (data) => {
9307
9286
  const t = typeof data;
@@ -17816,6 +17795,17 @@ function getDb() {
17816
17795
  read_at TEXT
17817
17796
  )
17818
17797
  `);
17798
+ const initialMsgCols = db.prepare("PRAGMA table_info(messages)").all();
17799
+ const initialMsgColNames = initialMsgCols.map((c) => c.name);
17800
+ if (initialMsgColNames.includes("channel") && !initialMsgColNames.includes("space")) {
17801
+ db.exec("ALTER TABLE messages ADD COLUMN space TEXT");
17802
+ db.exec("UPDATE messages SET space = channel WHERE channel IS NOT NULL");
17803
+ db.exec(`
17804
+ UPDATE messages
17805
+ SET session_id = 'space:' || substr(session_id, 9)
17806
+ WHERE session_id LIKE 'channel:%'
17807
+ `);
17808
+ }
17819
17809
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_session ON messages(session_id)");
17820
17810
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
17821
17811
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
@@ -46840,11 +46830,11 @@ data:
46840
46830
  }
46841
46831
 
46842
46832
  // src/mcp/http.ts
46843
- var DEFAULT_MCP_HTTP_PORT = 8811;
46833
+ var DEFAULT_MCP_HTTP_PORT = 8856;
46844
46834
  var MCP_HTTP_HOST = "127.0.0.1";
46845
46835
  var MCP_SERVICE_NAME = "conversations";
46846
- function isHttpMode(args) {
46847
- return args.includes("--http") || process.env.MCP_HTTP === "1";
46836
+ function isStdioMode(args) {
46837
+ return args.includes("--stdio") || process.env.MCP_STDIO === "1";
46848
46838
  }
46849
46839
  function resolveMcpHttpPort(args) {
46850
46840
  const portIdx = args.indexOf("--port");
@@ -46889,7 +46879,7 @@ function startMcpHttpServer(options) {
46889
46879
  // package.json
46890
46880
  var package_default = {
46891
46881
  name: "@hasna/conversations",
46892
- version: "0.2.49",
46882
+ version: "0.2.51",
46893
46883
  description: "Real-time CLI messaging for AI agents",
46894
46884
  type: "module",
46895
46885
  bin: {
@@ -47015,12 +47005,12 @@ async function main() {
47015
47005
 
47016
47006
  Usage:
47017
47007
  conversations-mcp stdio transport (default)
47018
- conversations-mcp --http Streamable HTTP on 127.0.0.1:8811
47008
+ conversations-mcp --http Streamable HTTP on 127.0.0.1:8856
47019
47009
  conversations-mcp --http --port <n>
47020
47010
 
47021
47011
  Environment:
47022
47012
  MCP_HTTP=1 Enable HTTP mode
47023
- MCP_HTTP_PORT=<n> Override default port (8811)
47013
+ MCP_HTTP_PORT=<n> Override default port (8856)
47024
47014
  `);
47025
47015
  return;
47026
47016
  }
@@ -47028,15 +47018,15 @@ Environment:
47028
47018
  console.log(package_default.version);
47029
47019
  return;
47030
47020
  }
47031
- if (isHttpMode(args)) {
47032
- startMcpHttpServer({
47033
- name: "conversations",
47034
- port: resolveMcpHttpPort(args),
47035
- buildServer: () => buildServer(true)
47036
- });
47021
+ if (isStdioMode(args)) {
47022
+ await startMcpServer();
47037
47023
  return;
47038
47024
  }
47039
- await startMcpServer();
47025
+ startMcpHttpServer({
47026
+ name: "conversations",
47027
+ port: resolveMcpHttpPort(args),
47028
+ buildServer: () => buildServer(true)
47029
+ });
47040
47030
  }
47041
47031
  if (isDirectRun) {
47042
47032
  main().catch((error48) => {
package/dist/index.js CHANGED
@@ -5,60 +5,39 @@ var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- function __accessProp(key) {
9
- return this[key];
10
- }
11
- var __toESMCache_node;
12
- var __toESMCache_esm;
13
8
  var __toESM = (mod, isNodeMode, target) => {
14
- var canCache = mod != null && typeof mod === "object";
15
- if (canCache) {
16
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
- var cached = cache.get(mod);
18
- if (cached)
19
- return cached;
20
- }
21
9
  target = mod != null ? __create(__getProtoOf(mod)) : {};
22
10
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
11
  for (let key of __getOwnPropNames(mod))
24
12
  if (!__hasOwnProp.call(to, key))
25
13
  __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
14
+ get: () => mod[key],
27
15
  enumerable: true
28
16
  });
29
- if (canCache)
30
- cache.set(mod, to);
31
17
  return to;
32
18
  };
19
+ var __moduleCache = /* @__PURE__ */ new WeakMap;
33
20
  var __toCommonJS = (from) => {
34
- var entry = (__moduleCache ??= new WeakMap).get(from), desc;
21
+ var entry = __moduleCache.get(from), desc;
35
22
  if (entry)
36
23
  return entry;
37
24
  entry = __defProp({}, "__esModule", { value: true });
38
- if (from && typeof from === "object" || typeof from === "function") {
39
- for (var key of __getOwnPropNames(from))
40
- if (!__hasOwnProp.call(entry, key))
41
- __defProp(entry, key, {
42
- get: __accessProp.bind(from, key),
43
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
- });
45
- }
25
+ if (from && typeof from === "object" || typeof from === "function")
26
+ __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
27
+ get: () => from[key],
28
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
+ }));
46
30
  __moduleCache.set(from, entry);
47
31
  return entry;
48
32
  };
49
- var __moduleCache;
50
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
51
- var __returnValue = (v) => v;
52
- function __exportSetter(name, newValue) {
53
- this[name] = __returnValue.bind(null, newValue);
54
- }
55
34
  var __export = (target, all) => {
56
35
  for (var name in all)
57
36
  __defProp(target, name, {
58
37
  get: all[name],
59
38
  enumerable: true,
60
39
  configurable: true,
61
- set: __exportSetter.bind(all, name)
40
+ set: (newValue) => all[name] = () => newValue
62
41
  });
63
42
  };
64
43
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -84,11 +63,11 @@ import { homedir as homedir4 } from "os";
84
63
  import { join as join4 } from "path";
85
64
  import { join as join6, dirname } from "path";
86
65
  import { homedir as homedir5, platform } from "os";
87
- function __accessProp2(key) {
66
+ function __accessProp(key) {
88
67
  return this[key];
89
68
  }
90
- function __exportSetter2(name, newValue) {
91
- this[name] = __returnValue2.bind(null, newValue);
69
+ function __exportSetter(name, newValue) {
70
+ this[name] = __returnValue.bind(null, newValue);
92
71
  }
93
72
  function translateSql(sql, dialect) {
94
73
  if (dialect === "sqlite")
@@ -1118,10 +1097,10 @@ class SyncProgressTracker {
1118
1097
  }
1119
1098
  }
1120
1099
  }
1121
- var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node2, __toESMCache_esm2, __toESM2 = (mod, isNodeMode, target) => {
1100
+ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node, __toESMCache_esm, __toESM2 = (mod, isNodeMode, target) => {
1122
1101
  var canCache = mod != null && typeof mod === "object";
1123
1102
  if (canCache) {
1124
- var cache = isNodeMode ? __toESMCache_node2 ??= new WeakMap : __toESMCache_esm2 ??= new WeakMap;
1103
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
1125
1104
  var cached = cache.get(mod);
1126
1105
  if (cached)
1127
1106
  return cached;
@@ -1131,19 +1110,19 @@ var __create2, __getProtoOf2, __defProp2, __getOwnPropNames2, __hasOwnProp2, __t
1131
1110
  for (let key of __getOwnPropNames2(mod))
1132
1111
  if (!__hasOwnProp2.call(to, key))
1133
1112
  __defProp2(to, key, {
1134
- get: __accessProp2.bind(mod, key),
1113
+ get: __accessProp.bind(mod, key),
1135
1114
  enumerable: true
1136
1115
  });
1137
1116
  if (canCache)
1138
1117
  cache.set(mod, to);
1139
1118
  return to;
1140
- }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue2 = (v) => v, __export2 = (target, all) => {
1119
+ }, __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports), __returnValue = (v) => v, __export2 = (target, all) => {
1141
1120
  for (var name in all)
1142
1121
  __defProp2(target, name, {
1143
1122
  get: all[name],
1144
1123
  enumerable: true,
1145
1124
  configurable: true,
1146
- set: __exportSetter2.bind(all, name)
1125
+ set: __exportSetter.bind(all, name)
1147
1126
  });
1148
1127
  }, __esm2 = (fn, res) => () => (fn && (res = fn(fn = 0)), res), __require, require_postgres_array, require_arrayParser, require_postgres_date, require_mutable, require_postgres_interval, require_postgres_bytea, require_textParsers, require_pg_int8, require_binaryParsers, require_builtins, require_pg_types, require_defaults, require_utils, require_utils_legacy, require_utils_webcrypto, require_utils2, require_cert_signatures, require_sasl, require_type_overrides, require_pg_connection_string, require_connection_parameters, require_result, require_query, require_messages, require_buffer_writer, require_serializer, require_buffer_reader, require_parser, require_dist, require_empty, require_stream, require_connection, require_split2, require_helper, require_lib, require_client, require_pg_pool, require_query2, require_client2, require_lib2, import_lib, Client, Pool, Connection, types, Query, DatabaseError, escapeIdentifier, escapeLiteral, Result, TypeOverrides, defaults, esm_default, init_esm, init_adapter, util, objectUtil, ZodParsedType, getParsedType = (data) => {
1149
1128
  const t = typeof data;
@@ -9638,6 +9617,17 @@ function getDb() {
9638
9617
  read_at TEXT
9639
9618
  )
9640
9619
  `);
9620
+ const initialMsgCols = db.prepare("PRAGMA table_info(messages)").all();
9621
+ const initialMsgColNames = initialMsgCols.map((c) => c.name);
9622
+ if (initialMsgColNames.includes("channel") && !initialMsgColNames.includes("space")) {
9623
+ db.exec("ALTER TABLE messages ADD COLUMN space TEXT");
9624
+ db.exec("UPDATE messages SET space = channel WHERE channel IS NOT NULL");
9625
+ db.exec(`
9626
+ UPDATE messages
9627
+ SET session_id = 'space:' || substr(session_id, 9)
9628
+ WHERE session_id LIKE 'channel:%'
9629
+ `);
9630
+ }
9641
9631
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_session ON messages(session_id)");
9642
9632
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_to ON messages(to_agent)");
9643
9633
  db.exec("CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)");
@@ -1,8 +1,9 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare const DEFAULT_MCP_HTTP_PORT = 8811;
2
+ export declare const DEFAULT_MCP_HTTP_PORT = 8856;
3
3
  export declare const MCP_HTTP_HOST = "127.0.0.1";
4
4
  export declare const MCP_SERVICE_NAME = "conversations";
5
5
  export declare function isHttpMode(args: string[]): boolean;
6
+ export declare function isStdioMode(args: string[]): boolean;
6
7
  export declare function resolveMcpHttpPort(args: string[]): number;
7
8
  export declare function healthPayload(name?: string): {
8
9
  status: string;
@@ -6,7 +6,7 @@
6
6
  * Usage:
7
7
  * conversations mcp # Start MCP server on stdio (40+ tools)
8
8
  * conversations-mcp # Direct binary
9
- * conversations-mcp --http # Streamable HTTP on 127.0.0.1:8811
9
+ * conversations-mcp --http # Streamable HTTP on 127.0.0.1:8856
10
10
  */
11
11
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
12
12
  export declare function buildServer(forHttp?: boolean): McpServer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/conversations",
3
- "version": "0.2.49",
3
+ "version": "0.2.51",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {