session-collab-mcp 0.4.6 → 0.4.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "session-collab-mcp",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "MCP server for Claude Code session collaboration - prevents conflicts between parallel sessions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,7 +39,8 @@ class SqlitePreparedStatement implements PreparedStatement {
39
39
 
40
40
  constructor(
41
41
  private db: Database.Database,
42
- private sql: string
42
+ private sql: string,
43
+ private onWrite?: () => void
43
44
  ) {}
44
45
 
45
46
  bind(...values: unknown[]): PreparedStatement {
@@ -65,6 +66,8 @@ class SqlitePreparedStatement implements PreparedStatement {
65
66
  async run(): Promise<{ meta: { changes: number } }> {
66
67
  const stmt = this.db.prepare(this.sql);
67
68
  const result = stmt.run(...this.bindings);
69
+ // Trigger checkpoint after write
70
+ this.onWrite?.();
68
71
  return {
69
72
  meta: { changes: result.changes },
70
73
  };
@@ -88,12 +91,25 @@ class SqliteDatabase implements DatabaseAdapter {
88
91
  }
89
92
 
90
93
  this.db = new Database(dbPath);
94
+
95
+ // Multi-process SQLite configuration
91
96
  this.db.pragma('journal_mode = WAL');
92
97
  this.db.pragma('foreign_keys = ON');
98
+ this.db.pragma('busy_timeout = 5000'); // Wait up to 5s for locks
99
+ this.db.pragma('synchronous = NORMAL'); // Ensure durability
100
+ this.db.pragma('wal_autocheckpoint = 100'); // Checkpoint every 100 pages
101
+
102
+ // Checkpoint on open to see latest data from other processes
103
+ this.db.pragma('wal_checkpoint(PASSIVE)');
104
+ }
105
+
106
+ // Force checkpoint to make changes visible to other processes
107
+ checkpoint(): void {
108
+ this.db.pragma('wal_checkpoint(PASSIVE)');
93
109
  }
94
110
 
95
111
  prepare(sql: string): PreparedStatement {
96
- return new SqlitePreparedStatement(this.db, sql);
112
+ return new SqlitePreparedStatement(this.db, sql, () => this.checkpoint());
97
113
  }
98
114
 
99
115
  async batch(statements: PreparedStatement[]): Promise<QueryResult<unknown>[]> {
@@ -107,7 +123,10 @@ class SqliteDatabase implements DatabaseAdapter {
107
123
  };
108
124
  });
109
125
  });
110
- return transaction();
126
+ const results = transaction();
127
+ // Checkpoint after batch write
128
+ this.checkpoint();
129
+ return results;
111
130
  }
112
131
 
113
132
  // Initialize database schema
package/src/mcp/server.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  // MCP Server implementation for Session Collaboration
2
+ // Last edited: 2025-12-29 by session-b
2
3
 
3
4
  import type { DatabaseAdapter } from '../db/sqlite-adapter.js';
4
5
  import {