@grafema/rfdb 0.2.12-dev1 → 0.3.1-beta

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
@@ -37,12 +37,56 @@ npx @grafema/rfdb ./my-graph.rfdb --socket /tmp/rfdb.sock
37
37
  rfdb-server ./my-graph.rfdb
38
38
  ```
39
39
 
40
+ ### Web / Remote Setup (WebSocket Transport)
41
+
42
+ For browser-based environments (VS Code web, code-server, Gitpod) or remote access scenarios, use WebSocket transport instead of Unix sockets.
43
+
44
+ **Start Server with WebSocket:**
45
+
46
+ ```bash
47
+ rfdb-server ./path/to/graph.rfdb --socket /tmp/rfdb.sock --ws-port 7474
48
+ ```
49
+
50
+ This starts BOTH transports simultaneously:
51
+ - Unix socket at `/tmp/rfdb.sock` (for local CLI/MCP)
52
+ - WebSocket at `ws://127.0.0.1:7474` (for web/remote clients)
53
+
54
+ **Configure VS Code Extension:**
55
+
56
+ In VS Code settings (Cmd+, or Ctrl+,):
57
+
58
+ ```json
59
+ {
60
+ "grafema.rfdbTransport": "websocket",
61
+ "grafema.rfdbWebSocketUrl": "ws://localhost:7474"
62
+ }
63
+ ```
64
+
65
+ Or via UI: Search for "Grafema" → Set "RFDB Transport" to "websocket".
66
+
67
+ **When to Use WebSocket:**
68
+
69
+ - **VS Code web (vscode.dev)** - Unix sockets unavailable in browser
70
+ - **code-server / Gitpod** - Remote development environments
71
+ - **Browser clients** - When building web-based graph explorers
72
+ - **Remote access** - Connect to graph database on different machine (via SSH tunnel)
73
+
74
+ **Security Note:**
75
+
76
+ WebSocket binds to `127.0.0.1` only (localhost). For remote access, use SSH tunnel:
77
+
78
+ ```bash
79
+ ssh -L 7474:127.0.0.1:7474 user@remote-server
80
+ ```
81
+
82
+ Then connect to `ws://localhost:7474` locally.
83
+
40
84
  ### Programmatic usage
41
85
 
42
- Server lifecycle is managed through `@grafema/core`:
86
+ Server lifecycle is managed through `@grafema/util`:
43
87
 
44
88
  ```javascript
45
- const { startRfdbServer, RFDBServerBackend } = require('@grafema/core');
89
+ const { startRfdbServer, RFDBServerBackend } = require('@grafema/util');
46
90
 
47
91
  // Start server (handles binary discovery, socket polling, PID file)
48
92
  const server = await startRfdbServer({
@@ -72,12 +116,10 @@ if (!isAvailable()) {
72
116
  RFDB is the default storage backend for Grafema. The MCP server and CLI auto-start RFDB when needed.
73
117
 
74
118
  ```javascript
75
- const { Orchestrator, RFDBServerBackend } = require('@grafema/core');
119
+ const { RFDBServerBackend } = require('@grafema/util');
76
120
 
77
- const orchestrator = new Orchestrator({
78
- rootDir: './src',
79
- backend: new RFDBServerBackend({ socketPath: '.grafema/rfdb.sock' }),
80
- });
121
+ const backend = new RFDBServerBackend({ socketPath: '.grafema/rfdb.sock' });
122
+ await backend.connect();
81
123
  ```
82
124
 
83
125
  ## Features
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Get the path to the rfdb-server binary for the current platform.
3
- * Only checks prebuilt directory. For full search, use findRfdbBinary() from @grafema/core.
4
- * @deprecated Use findRfdbBinary() from @grafema/core for full binary search.
3
+ * Only checks prebuilt directory. For full search, use findRfdbBinary() from @grafema/util.
4
+ * @deprecated Use findRfdbBinary() from @grafema/util for full binary search.
5
5
  * @returns Path to binary, or null if not available
6
6
  */
7
7
  export function getBinaryPath(): string | null;
package/index.js CHANGED
@@ -11,8 +11,8 @@ const net = require('net');
11
11
  /**
12
12
  * Get the path to the rfdb-server binary for the current platform.
13
13
  * Only checks prebuilt directory. For full search (monorepo, PATH, env var, ~/.local/bin),
14
- * use findRfdbBinary() from @grafema/core instead.
15
- * @deprecated Use findRfdbBinary() from @grafema/core for full binary search.
14
+ * use findRfdbBinary() from @grafema/util instead.
15
+ * @deprecated Use findRfdbBinary() from @grafema/util for full binary search.
16
16
  * @returns {string|null} Path to binary, or null if not available
17
17
  */
18
18
  function getBinaryPath() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafema/rfdb",
3
- "version": "0.2.12-dev1",
3
+ "version": "0.3.1-beta",
4
4
  "description": "RFDB (Rega Flow Database) — high-performance disk-backed graph database server for Grafema",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",