@seamnet/client 0.3.0 → 0.3.1
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 -1
- package/lib/init.js +1 -6
- package/lib/paths.js +1 -1
- package/lib/stop.js +11 -15
- package/package.json +1 -1
package/lib/guardian.js
CHANGED
|
@@ -56,7 +56,9 @@ export async function guardianRun() {
|
|
|
56
56
|
console.log(`[guardian] Starting for ${creds.userId}...`);
|
|
57
57
|
|
|
58
58
|
// Load IM plugin (creates SDK connection + unix socket server)
|
|
59
|
-
const {
|
|
59
|
+
const { createRequire } = await import('node:module');
|
|
60
|
+
const require = createRequire(import.meta.url);
|
|
61
|
+
const { createImPlugin } = require('./plugins/im.cjs');
|
|
60
62
|
const imPlugin = await createImPlugin({
|
|
61
63
|
credentials: creds,
|
|
62
64
|
socketPath: SOCKET_PATH,
|
package/lib/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync, readFileSync, chmodSync
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync, chmodSync } from 'node:fs';
|
|
2
2
|
import { execSync } from 'node:child_process';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
@@ -75,11 +75,6 @@ export async function init({ inviteCode, name, apiBase }) {
|
|
|
75
75
|
const readme = readFileSync(join(TEMPLATES_DIR, 'README.md'), 'utf8');
|
|
76
76
|
writeFileSync(README_PATH, readme);
|
|
77
77
|
|
|
78
|
-
// Step 8: Copy mcp-server.cjs to .seam/
|
|
79
|
-
const mcpServerSrc = join(__dirname, 'mcp-server.cjs');
|
|
80
|
-
const mcpServerDest = join(SEAM_DIR, 'mcp-server.cjs');
|
|
81
|
-
copyFileSync(mcpServerSrc, mcpServerDest);
|
|
82
|
-
console.log(' MCP server installed.');
|
|
83
78
|
|
|
84
79
|
// Step 9: Write .mcp.json in current directory
|
|
85
80
|
writeMcpConfig(result);
|
package/lib/paths.js
CHANGED
|
@@ -6,5 +6,5 @@ export const CONFIG_PATH = join(SEAM_DIR, 'config.yaml');
|
|
|
6
6
|
export const VERSION_PATH = join(SEAM_DIR, 'version.json');
|
|
7
7
|
export const IDENTITY_PATH = join(SEAM_DIR, 'IDENTITY.md');
|
|
8
8
|
export const README_PATH = join(SEAM_DIR, 'README.md');
|
|
9
|
-
export const
|
|
9
|
+
export const SOCKET_PATH = join(SEAM_DIR, 'guardian.sock');
|
|
10
10
|
export const LOGS_DIR = join(SEAM_DIR, 'logs');
|
package/lib/stop.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { existsSync, readFileSync
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
3
|
+
import { CREDENTIALS_PATH } from './paths.js';
|
|
3
4
|
|
|
4
5
|
export async function stop() {
|
|
5
|
-
if (!existsSync(
|
|
6
|
-
console.log('
|
|
6
|
+
if (!existsSync(CREDENTIALS_PATH)) {
|
|
7
|
+
console.log('No credentials found. Nothing to stop.');
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
+
const creds = JSON.parse(readFileSync(CREDENTIALS_PATH, 'utf8'));
|
|
12
|
+
const sessionName = `seam-guardian-${creds.userId}`;
|
|
11
13
|
|
|
12
14
|
try {
|
|
13
|
-
|
|
14
|
-
console.log(`Guardian stopped (
|
|
15
|
-
} catch
|
|
16
|
-
|
|
17
|
-
console.log(`Guardian was not running (stale PID ${pid}).`);
|
|
18
|
-
} else {
|
|
19
|
-
throw e;
|
|
20
|
-
}
|
|
15
|
+
execSync(`tmux kill-session -t ${sessionName}`, { stdio: 'ignore' });
|
|
16
|
+
console.log(`Guardian stopped (tmux session: ${sessionName})`);
|
|
17
|
+
} catch {
|
|
18
|
+
console.log('Guardian is not running.');
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
unlinkSync(GUARDIAN_PID_PATH);
|
|
24
20
|
}
|