@hasna/conversations 0.2.49 → 0.2.50

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
@@ -3668,9 +3668,9 @@ async function syncTransfer(source, target, options, _direction) {
3668
3668
  const batch = rows.slice(offset, offset + batchSize);
3669
3669
  try {
3670
3670
  if (isAsyncAdapter(target)) {
3671
- await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch, columns.includes(conflictColumn) ? conflictColumn : undefined);
3671
+ await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch);
3672
3672
  } else {
3673
- batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch, columns.includes(conflictColumn) ? conflictColumn : undefined);
3673
+ batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch);
3674
3674
  }
3675
3675
  result.rowsWritten += batch.length;
3676
3676
  } catch (err) {
@@ -3717,7 +3717,7 @@ async function syncTransfer(source, target, options, _direction) {
3717
3717
  }
3718
3718
  return results;
3719
3719
  }
3720
- async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch, conflictColumn) {
3720
+ async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch) {
3721
3721
  if (batch.length === 0)
3722
3722
  return;
3723
3723
  const colList = columns.map((c) => `"${c}"`).join(", ");
@@ -3727,22 +3727,20 @@ async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, ba
3727
3727
  }).join(", ");
3728
3728
  const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
3729
3729
  const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
3730
- const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
3731
3730
  const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
3732
- ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}${whereClause}`;
3731
+ ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
3733
3732
  const params = batch.flatMap((row) => columns.map((c) => row[c] ?? null));
3734
3733
  await target.run(sql, ...params);
3735
3734
  }
3736
- function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch, conflictColumn) {
3735
+ function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch) {
3737
3736
  if (batch.length === 0)
3738
3737
  return;
3739
3738
  const colList = columns.map((c) => `"${c}"`).join(", ");
3740
3739
  const valuePlaceholders = batch.map(() => `(${columns.map(() => "?").join(", ")})`).join(", ");
3741
3740
  const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
3742
3741
  const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
3743
- const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
3744
3742
  const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
3745
- ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}${whereClause}`;
3743
+ ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
3746
3744
  const params = batch.flatMap((row) => columns.map((c) => coerceForSqlite(row[c])));
3747
3745
  target.run(sql, ...params);
3748
3746
  }
@@ -4812,7 +4810,7 @@ async function ensureAllPgDatabases() {
4812
4810
  }
4813
4811
  return results;
4814
4812
  }
4815
- function registerCloudTools(server, serviceName, opts = {}) {
4813
+ function registerCloudTools(server, serviceName) {
4816
4814
  server.tool(`${serviceName}_cloud_status`, "Show cloud configuration and connection health", {}, async () => {
4817
4815
  const config = getCloudConfig();
4818
4816
  const lines = [
@@ -4845,13 +4843,8 @@ function registerCloudTools(server, serviceName, opts = {}) {
4845
4843
  isError: true
4846
4844
  };
4847
4845
  }
4848
- const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
4846
+ const local = new SqliteAdapter(getDbPath(serviceName));
4849
4847
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
4850
- if (opts.migrations?.length) {
4851
- for (const sql of opts.migrations) {
4852
- await cloud.run(sql);
4853
- }
4854
- }
4855
4848
  const tableList = tablesStr ? tablesStr.split(",").map((t) => t.trim()) : listSqliteTables(local);
4856
4849
  const results = await syncPush(local, cloud, { tables: tableList });
4857
4850
  local.close();
@@ -4873,7 +4866,7 @@ function registerCloudTools(server, serviceName, opts = {}) {
4873
4866
  isError: true
4874
4867
  };
4875
4868
  }
4876
- const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
4869
+ const local = new SqliteAdapter(getDbPath(serviceName));
4877
4870
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
4878
4871
  let tableList;
4879
4872
  if (tablesStr) {
@@ -15538,7 +15531,7 @@ var init_space_notifications = __esm(() => {
15538
15531
  var require_package = __commonJS((exports, module) => {
15539
15532
  module.exports = {
15540
15533
  name: "@hasna/conversations",
15541
- version: "0.2.49",
15534
+ version: "0.2.50",
15542
15535
  description: "Real-time CLI messaging for AI agents",
15543
15536
  type: "module",
15544
15537
  bin: {
@@ -49657,8 +49650,8 @@ var init_webStandardStreamableHttp = __esm(() => {
49657
49650
  });
49658
49651
 
49659
49652
  // src/mcp/http.ts
49660
- function isHttpMode(args) {
49661
- return args.includes("--http") || process.env.MCP_HTTP === "1";
49653
+ function isStdioMode(args) {
49654
+ return args.includes("--stdio") || process.env.MCP_STDIO === "1";
49662
49655
  }
49663
49656
  function resolveMcpHttpPort(args) {
49664
49657
  const portIdx = args.indexOf("--port");
@@ -49700,7 +49693,7 @@ function startMcpHttpServer(options) {
49700
49693
  console.error(`${name}-mcp HTTP listening on http://${MCP_HTTP_HOST}:${port}/mcp`);
49701
49694
  return server;
49702
49695
  }
49703
- var DEFAULT_MCP_HTTP_PORT = 8811, MCP_HTTP_HOST = "127.0.0.1", MCP_SERVICE_NAME = "conversations";
49696
+ var DEFAULT_MCP_HTTP_PORT = 8856, MCP_HTTP_HOST = "127.0.0.1", MCP_SERVICE_NAME = "conversations";
49704
49697
  var init_http = __esm(() => {
49705
49698
  init_webStandardStreamableHttp();
49706
49699
  });
@@ -49754,12 +49747,12 @@ async function main() {
49754
49747
 
49755
49748
  Usage:
49756
49749
  conversations-mcp stdio transport (default)
49757
- conversations-mcp --http Streamable HTTP on 127.0.0.1:8811
49750
+ conversations-mcp --http Streamable HTTP on 127.0.0.1:8856
49758
49751
  conversations-mcp --http --port <n>
49759
49752
 
49760
49753
  Environment:
49761
49754
  MCP_HTTP=1 Enable HTTP mode
49762
- MCP_HTTP_PORT=<n> Override default port (8811)
49755
+ MCP_HTTP_PORT=<n> Override default port (8856)
49763
49756
  `);
49764
49757
  return;
49765
49758
  }
@@ -49767,15 +49760,15 @@ Environment:
49767
49760
  console.log(import__package2.default.version);
49768
49761
  return;
49769
49762
  }
49770
- if (isHttpMode(args)) {
49771
- startMcpHttpServer({
49772
- name: "conversations",
49773
- port: resolveMcpHttpPort(args),
49774
- buildServer: () => buildServer(true)
49775
- });
49763
+ if (isStdioMode(args)) {
49764
+ await startMcpServer();
49776
49765
  return;
49777
49766
  }
49778
- await startMcpServer();
49767
+ startMcpHttpServer({
49768
+ name: "conversations",
49769
+ port: resolveMcpHttpPort(args),
49770
+ buildServer: () => buildServer(true)
49771
+ });
49779
49772
  }
49780
49773
  var import__package2, agentFocus, server, isDirectRun;
49781
49774
  var init_mcp2 = __esm(() => {
package/bin/mcp.js CHANGED
@@ -7948,9 +7948,9 @@ async function syncTransfer(source, target, options, _direction) {
7948
7948
  const batch = rows.slice(offset, offset + batchSize);
7949
7949
  try {
7950
7950
  if (isAsyncAdapter(target)) {
7951
- await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch, columns.includes(conflictColumn) ? conflictColumn : undefined);
7951
+ await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch);
7952
7952
  } else {
7953
- batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch, columns.includes(conflictColumn) ? conflictColumn : undefined);
7953
+ batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch);
7954
7954
  }
7955
7955
  result.rowsWritten += batch.length;
7956
7956
  } catch (err) {
@@ -7997,7 +7997,7 @@ async function syncTransfer(source, target, options, _direction) {
7997
7997
  }
7998
7998
  return results;
7999
7999
  }
8000
- async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch, conflictColumn) {
8000
+ async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch) {
8001
8001
  if (batch.length === 0)
8002
8002
  return;
8003
8003
  const colList = columns.map((c) => `"${c}"`).join(", ");
@@ -8007,22 +8007,20 @@ async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, ba
8007
8007
  }).join(", ");
8008
8008
  const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
8009
8009
  const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
8010
- const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
8011
8010
  const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
8012
- ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}${whereClause}`;
8011
+ ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
8013
8012
  const params = batch.flatMap((row) => columns.map((c) => row[c] ?? null));
8014
8013
  await target.run(sql, ...params);
8015
8014
  }
8016
- function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch, conflictColumn) {
8015
+ function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch) {
8017
8016
  if (batch.length === 0)
8018
8017
  return;
8019
8018
  const colList = columns.map((c) => `"${c}"`).join(", ");
8020
8019
  const valuePlaceholders = batch.map(() => `(${columns.map(() => "?").join(", ")})`).join(", ");
8021
8020
  const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
8022
8021
  const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
8023
- const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
8024
8022
  const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
8025
- ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}${whereClause}`;
8023
+ ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
8026
8024
  const params = batch.flatMap((row) => columns.map((c) => coerceForSqlite(row[c])));
8027
8025
  target.run(sql, ...params);
8028
8026
  }
@@ -9092,7 +9090,7 @@ async function ensureAllPgDatabases() {
9092
9090
  }
9093
9091
  return results;
9094
9092
  }
9095
- function registerCloudTools(server, serviceName, opts = {}) {
9093
+ function registerCloudTools(server, serviceName) {
9096
9094
  server.tool(`${serviceName}_cloud_status`, "Show cloud configuration and connection health", {}, async () => {
9097
9095
  const config2 = getCloudConfig();
9098
9096
  const lines = [
@@ -9125,13 +9123,8 @@ function registerCloudTools(server, serviceName, opts = {}) {
9125
9123
  isError: true
9126
9124
  };
9127
9125
  }
9128
- const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
9126
+ const local = new SqliteAdapter(getDbPath(serviceName));
9129
9127
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
9130
- if (opts.migrations?.length) {
9131
- for (const sql of opts.migrations) {
9132
- await cloud.run(sql);
9133
- }
9134
- }
9135
9128
  const tableList = tablesStr ? tablesStr.split(",").map((t) => t.trim()) : listSqliteTables(local);
9136
9129
  const results = await syncPush(local, cloud, { tables: tableList });
9137
9130
  local.close();
@@ -9153,7 +9146,7 @@ function registerCloudTools(server, serviceName, opts = {}) {
9153
9146
  isError: true
9154
9147
  };
9155
9148
  }
9156
- const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
9149
+ const local = new SqliteAdapter(getDbPath(serviceName));
9157
9150
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
9158
9151
  let tableList;
9159
9152
  if (tablesStr) {
@@ -46840,11 +46833,11 @@ data:
46840
46833
  }
46841
46834
 
46842
46835
  // src/mcp/http.ts
46843
- var DEFAULT_MCP_HTTP_PORT = 8811;
46836
+ var DEFAULT_MCP_HTTP_PORT = 8856;
46844
46837
  var MCP_HTTP_HOST = "127.0.0.1";
46845
46838
  var MCP_SERVICE_NAME = "conversations";
46846
- function isHttpMode(args) {
46847
- return args.includes("--http") || process.env.MCP_HTTP === "1";
46839
+ function isStdioMode(args) {
46840
+ return args.includes("--stdio") || process.env.MCP_STDIO === "1";
46848
46841
  }
46849
46842
  function resolveMcpHttpPort(args) {
46850
46843
  const portIdx = args.indexOf("--port");
@@ -46889,7 +46882,7 @@ function startMcpHttpServer(options) {
46889
46882
  // package.json
46890
46883
  var package_default = {
46891
46884
  name: "@hasna/conversations",
46892
- version: "0.2.49",
46885
+ version: "0.2.50",
46893
46886
  description: "Real-time CLI messaging for AI agents",
46894
46887
  type: "module",
46895
46888
  bin: {
@@ -47015,12 +47008,12 @@ async function main() {
47015
47008
 
47016
47009
  Usage:
47017
47010
  conversations-mcp stdio transport (default)
47018
- conversations-mcp --http Streamable HTTP on 127.0.0.1:8811
47011
+ conversations-mcp --http Streamable HTTP on 127.0.0.1:8856
47019
47012
  conversations-mcp --http --port <n>
47020
47013
 
47021
47014
  Environment:
47022
47015
  MCP_HTTP=1 Enable HTTP mode
47023
- MCP_HTTP_PORT=<n> Override default port (8811)
47016
+ MCP_HTTP_PORT=<n> Override default port (8856)
47024
47017
  `);
47025
47018
  return;
47026
47019
  }
@@ -47028,15 +47021,15 @@ Environment:
47028
47021
  console.log(package_default.version);
47029
47022
  return;
47030
47023
  }
47031
- if (isHttpMode(args)) {
47032
- startMcpHttpServer({
47033
- name: "conversations",
47034
- port: resolveMcpHttpPort(args),
47035
- buildServer: () => buildServer(true)
47036
- });
47024
+ if (isStdioMode(args)) {
47025
+ await startMcpServer();
47037
47026
  return;
47038
47027
  }
47039
- await startMcpServer();
47028
+ startMcpHttpServer({
47029
+ name: "conversations",
47030
+ port: resolveMcpHttpPort(args),
47031
+ buildServer: () => buildServer(true)
47032
+ });
47040
47033
  }
47041
47034
  if (isDirectRun) {
47042
47035
  main().catch((error48) => {
@@ -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.50",
4
4
  "description": "Real-time CLI messaging for AI agents",
5
5
  "type": "module",
6
6
  "bin": {