@seamnet/client 0.3.3 → 0.3.5
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/lib/guardian.js +3 -3
- package/lib/init.js +20 -2
- package/lib/mcp-server.cjs +18 -5
- package/lib/plugins/im.cjs +11 -6
- package/package.json +1 -1
- package/templates/seam-skill.md +22 -17
package/lib/guardian.js
CHANGED
|
@@ -33,11 +33,11 @@ export async function guardianStart() {
|
|
|
33
33
|
// Ensure logs dir
|
|
34
34
|
if (!existsSync(LOGS_DIR)) mkdirSync(LOGS_DIR, { recursive: true });
|
|
35
35
|
|
|
36
|
-
// Start guardian in tmux — use
|
|
37
|
-
const cliPath = new URL('../bin/cli.js', import.meta.url).pathname;
|
|
36
|
+
// Start guardian in tmux — use local node_modules path
|
|
38
37
|
const cwd = process.cwd();
|
|
38
|
+
const localCli = join(cwd, 'node_modules', '@seamnet', 'client', 'bin', 'cli.js');
|
|
39
39
|
execSync(
|
|
40
|
-
`tmux new-session -d -s ${sessionName} 'cd ${cwd} && node ${
|
|
40
|
+
`tmux new-session -d -s ${sessionName} 'cd ${cwd} && node ${localCli} guardian run 2>&1 | tee -a ${join(LOGS_DIR, 'guardian.log')}'`,
|
|
41
41
|
{ stdio: 'inherit' }
|
|
42
42
|
);
|
|
43
43
|
|
package/lib/init.js
CHANGED
|
@@ -76,6 +76,9 @@ export async function init({ inviteCode, name, apiBase }) {
|
|
|
76
76
|
writeFileSync(README_PATH, readme);
|
|
77
77
|
|
|
78
78
|
|
|
79
|
+
// Step 8b: Install package locally
|
|
80
|
+
installLocalPackage();
|
|
81
|
+
|
|
79
82
|
// Step 9: Write .mcp.json in current directory
|
|
80
83
|
writeMcpConfig(result);
|
|
81
84
|
|
|
@@ -135,6 +138,21 @@ function checkPrereqs(apiBase) {
|
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
|
|
141
|
+
function installLocalPackage() {
|
|
142
|
+
const pkgPath = join(process.cwd(), 'package.json');
|
|
143
|
+
if (!existsSync(pkgPath)) {
|
|
144
|
+
writeFileSync(pkgPath, JSON.stringify({
|
|
145
|
+
name: 'seam-home',
|
|
146
|
+
version: '1.0.0',
|
|
147
|
+
private: true,
|
|
148
|
+
}, null, 2));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
console.log(' Installing @seamnet/client locally...');
|
|
152
|
+
execSync('npm install @seamnet/client --save', { stdio: 'pipe', cwd: process.cwd() });
|
|
153
|
+
console.log(' @seamnet/client installed locally ✓');
|
|
154
|
+
}
|
|
155
|
+
|
|
138
156
|
function createSeamDir() {
|
|
139
157
|
if (!existsSync(SEAM_DIR)) {
|
|
140
158
|
mkdirSync(SEAM_DIR, { recursive: true });
|
|
@@ -158,8 +176,8 @@ function writeMcpConfig(result) {
|
|
|
158
176
|
if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
|
|
159
177
|
|
|
160
178
|
mcpConfig.mcpServers['seam-im'] = {
|
|
161
|
-
command: '
|
|
162
|
-
args: ['@seamnet
|
|
179
|
+
command: 'node',
|
|
180
|
+
args: [join(process.cwd(), 'node_modules', '@seamnet', 'client', 'bin', 'cli.js'), 'mcp-serve'],
|
|
163
181
|
};
|
|
164
182
|
|
|
165
183
|
writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2));
|
package/lib/mcp-server.cjs
CHANGED
|
@@ -14,16 +14,29 @@ const SOCKET_PATH = path.join(SEAM_DIR, 'guardian.sock');
|
|
|
14
14
|
function guardianRequest(payload) {
|
|
15
15
|
return new Promise((resolve, reject) => {
|
|
16
16
|
const conn = net.createConnection(SOCKET_PATH, () => {
|
|
17
|
-
conn.
|
|
17
|
+
conn.write(JSON.stringify(payload)); // write, not end — keep connection open for response
|
|
18
18
|
});
|
|
19
19
|
let data = '';
|
|
20
|
-
conn.on('data', (chunk) => {
|
|
20
|
+
conn.on('data', (chunk) => {
|
|
21
|
+
data += chunk;
|
|
22
|
+
// Try to parse response
|
|
23
|
+
try {
|
|
24
|
+
const res = JSON.parse(data);
|
|
25
|
+
conn.destroy();
|
|
26
|
+
resolve(res);
|
|
27
|
+
} catch {
|
|
28
|
+
// Not complete yet
|
|
29
|
+
}
|
|
30
|
+
});
|
|
21
31
|
conn.on('end', () => {
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
if (data) {
|
|
33
|
+
try { resolve(JSON.parse(data)); } catch { resolve({ error: data }); }
|
|
34
|
+
} else {
|
|
35
|
+
resolve({ error: 'Empty response from guardian' });
|
|
36
|
+
}
|
|
24
37
|
});
|
|
25
38
|
conn.on('error', (e) => {
|
|
26
|
-
reject(new Error(`Guardian not running. Start it first:
|
|
39
|
+
reject(new Error(`Guardian not running. Start it first: node node_modules/@seamnet/client/bin/cli.js guardian start`));
|
|
27
40
|
});
|
|
28
41
|
conn.setTimeout(10000, () => {
|
|
29
42
|
conn.destroy();
|
package/lib/plugins/im.cjs
CHANGED
|
@@ -141,16 +141,21 @@ function createImPlugin({ credentials, socketPath, seamDir }) {
|
|
|
141
141
|
|
|
142
142
|
const server = net.createServer((conn) => {
|
|
143
143
|
let data = '';
|
|
144
|
-
conn.on('data', (chunk) => {
|
|
145
|
-
|
|
144
|
+
conn.on('data', (chunk) => {
|
|
145
|
+
data += chunk;
|
|
146
|
+
// Try to parse as complete JSON
|
|
146
147
|
try {
|
|
147
148
|
const req = JSON.parse(data);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
handleRequest(req).then(res => {
|
|
150
|
+
conn.end(JSON.stringify(res));
|
|
151
|
+
}).catch(e => {
|
|
152
|
+
conn.end(JSON.stringify({ error: e.message }));
|
|
153
|
+
});
|
|
154
|
+
} catch {
|
|
155
|
+
// Not complete JSON yet, wait for more data
|
|
152
156
|
}
|
|
153
157
|
});
|
|
158
|
+
conn.on('error', () => {}); // Ignore connection errors
|
|
154
159
|
});
|
|
155
160
|
|
|
156
161
|
server.listen(socketPath, () => {
|
package/package.json
CHANGED
package/templates/seam-skill.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: seam
|
|
3
|
-
description: Seam network operations — check status, send messages, troubleshoot
|
|
3
|
+
description: Seam network operations — check status, send messages, update, troubleshoot
|
|
4
4
|
user-invocable: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -10,33 +10,38 @@ You are on the Seam network. Your identity is in `.seam/IDENTITY.md`.
|
|
|
10
10
|
|
|
11
11
|
## Quick Reference
|
|
12
12
|
|
|
13
|
-
- **Check status**:
|
|
13
|
+
- **Check status**: `node node_modules/@seamnet/client/bin/cli.js status`
|
|
14
14
|
- **Your credentials**: `.seam/credentials.json`
|
|
15
|
+
- **Your contacts**: `.seam/contacts.json`
|
|
15
16
|
- **Logs**: `.seam/logs/`
|
|
16
17
|
- **Full manual**: `.seam/README.md`
|
|
17
18
|
|
|
18
|
-
## MCP Tools
|
|
19
|
+
## MCP Tools
|
|
19
20
|
|
|
20
|
-
- `msg_send_im` — Send a direct message (
|
|
21
|
-
- `msg_send_group` — Send a group message (
|
|
21
|
+
- `msg_send_im` — Send a direct message (params: to, text)
|
|
22
|
+
- `msg_send_group` — Send a group message (params: group_id, text)
|
|
22
23
|
|
|
23
|
-
##
|
|
24
|
+
## Guardian
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
- Start: `node node_modules/@seamnet/client/bin/cli.js guardian start`
|
|
27
|
+
- Stop: `node node_modules/@seamnet/client/bin/cli.js guardian stop`
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
Run `seam-client status` — look for "Guardian: running".
|
|
29
|
+
## Update
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
When you receive an update notification:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm update @seamnet/client
|
|
35
|
+
node node_modules/@seamnet/client/bin/cli.js guardian stop
|
|
36
|
+
node node_modules/@seamnet/client/bin/cli.js guardian start
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then restart Claude Code to reload MCP server.
|
|
35
40
|
|
|
36
41
|
## Troubleshooting
|
|
37
42
|
|
|
38
43
|
| Symptom | Check |
|
|
39
44
|
|---------|-------|
|
|
40
|
-
| Can't send messages | Is guardian running? Check
|
|
41
|
-
| No new messages | Check
|
|
42
|
-
| Guardian won't start |
|
|
45
|
+
| Can't send messages | Is guardian running? Check `.seam/logs/` |
|
|
46
|
+
| No new messages | Check guardian logs for connection errors |
|
|
47
|
+
| Guardian won't start | Is tmux installed? Are you in tmux? |
|